Android 使用mapview时,将显示栅格而不是地图
我知道在这个话题上有很多问题。我已经讨论了所有这些问题,并尝试了在stack overflow和其他网站上给出的许多建议。但不幸的是,没有人能解决我的问题 当我使用MapView和MapsActivity时,将显示栅格而不是地图。正如所建议的,我已经重新生成了API密钥,并且我已经确保我提供了与我的应用程序相同的包名,SHA1密钥,并且我已经在凭据中启用了Android的Google Maps API。我已授予映射所需的所有权限,在Manifestfile.xml中,我的清单文件如下所示:Android 使用mapview时,将显示栅格而不是地图,android,google-maps,android-fragments,Android,Google Maps,Android Fragments,我知道在这个话题上有很多问题。我已经讨论了所有这些问题,并尝试了在stack overflow和其他网站上给出的许多建议。但不幸的是,没有人能解决我的问题 当我使用MapView和MapsActivity时,将显示栅格而不是地图。正如所建议的,我已经重新生成了API密钥,并且我已经确保我提供了与我的应用程序相同的包名,SHA1密钥,并且我已经在凭据中启用了Android的Google Maps API。我已授予映射所需的所有权限,在Manifestfile.xml中,我的清单文件如下所示: &l
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.samplemaps"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="19" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>
<permission
android:name="com.example.permission.MAPS_RECEIVE"
android:protectionLevel="signature"/>
<uses-permission android:name="com.example.permission.MAPS_RECEIVE"/>
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme">
<uses-library android:name="com.google.android.maps"/>
<activity
android:name=".MapsActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="AIzaSyClOHCG7SBYxg1o6YdUWhn03VSqWwE1y_g"/>
<meta-data android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
</application>
</manifest>
使用上述活动时,将显示网格。当我扩展FragmentActivity而不是MapAcitivity和fragment而不是mapview时,我收到一个错误,它说不幸停止,有时它说某个片段类错误
我还为我正在使用的模拟器安装了GoogleAPI系统映像。我也下载了谷歌游戏服务。但是,地图并没有显示给我。我几乎做了其他问题中建议的所有事情
我的应用程序中有什么错误或错误阻止地图显示,而显示网格
提前谢谢。它在设备上工作吗?你看过Vogella的吗?它还详细介绍了v2地图。或者,您可以通过查看地图Android文档页面来使用最新版本的Google地图。@nasch ya,我已经试过了。网格显示在模拟器和移动设备中。@adjuremods我刚才已经试过了。它说不幸地停止了。我试图通过使用try-catch来了解错误。但它仍然没有显示错误。LogCat显示了许多错误,如:找不到类'com.google.android.gms.maps.model.LatLng'和'com.google.android.gms.maps.MapFragment'
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<com.google.android.gms.maps.MapView android:id="@+id/map"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
</LinearLayout>
package com.example.mapsample;
import android.os.Bundle;
import com.google.android.maps.MapActivity;
public class GoogleMaps_Sample extends MapActivity{
public void onCreate(Bundle b){
super.onCreate(b);
setContentView(R.layout.googlemapssample);
}
@Override
protected boolean isRouteDisplayed() {
// TODO Auto-generated method stub
return false;
}
}