我目前正在开发一款使用Google Maps API v2的应用。但MapView仅显示灰色背景,Google徽标和缩放按钮。
以下是错误消息:
10-27 10:50:25.309: D/REQUEST(18335): Connection opened to:https://clients4.google.com/glm/mmap/api
10-27 10:50:25.309: D/REQUEST(18335): Open Connection
10-27 10:50:26.239: D/REQUEST(18335): DRD(24): 62|147
10-27 10:50:26.239: D/REQUEST(18335): Close
10-27 10:50:26.239: D/REQUEST(18335): Error processing: com.google.maps.api.android.lib6.b.d@409cf570 not retrying
10-27 10:50:26.239: D/REQUEST(18335): Retrying: com.google.maps.api.android.lib6.c.au@409b25b8
另一个:
10-27 10:49:49.309: E/REQUEST(18335): In Error Mode
10-27 10:49:49.319: E/Google Maps Android API(18335): Failed to load map. Error contacting Google servers. This is probably an authentication issue (but could be due to network errors).
My Manifest确实包含我的API密钥和各种权限:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="de.hobbit.xmltest"
android:versionCode="1"
android:versionName="1.0" >
<permission
android:name="de.hobbit.xmltest.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="de.hobbit.xmltest.permission.MAPS_RECEIVE" />
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="8" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<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.WRITE_EXTERNAL_STORAGE" />
<!-- Required to show current location -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="SOMEKEY" />
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".SingleActivity"
android:label="@string/title_activity_single" >
</activity>
</application>
</manifest>
我希望有人能找到我的错误。
感谢。
答案 0 :(得分:1)
我使用了错误的密钥库......
我没有使用调试密钥库,而是使用了我的实际密钥库。
在eclipse中访问调试密钥库
1.转到Window-&gt; Preferences-&gt; Android-&gt; Build
2.复制SHA1指纹
3.使用调试密钥库
在Developers Console中生成API密钥