出现此错误。很抱歉这个问题,但我无法调查。
12-29 12:03:59.705: E/Google Maps Android API(15395): Authorization failure. Please see https://developers.google.com/maps/documentation/android/start for how to correctly set up the map.
12-29 12:03:59.720: E/Google Maps Android API(15395): In the Google Developer Console (https://console.developers.google.com)
Google Maps Android API: Ensure that the following correspond to what is in the API Console: Package Name: com.example.testmaps, API Key: XXX, Certificate Fingerprint: ZZZ
Google Maps Android API: Failed to contact Google servers. Another attempt will be made when connectivity is established.
Google Maps Android API: Failed to load map. Error contacting Google servers. This is probably an authentication issue (but could be due to network errors).
这是清单文件的代码:
<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="21" />
<permission
android:name="package.app.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="package.app.permission.MAPS_RECEIVE" />
<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" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="com.android.vending.BILLING" />
<!-- Maps API needs OpenGL ES 2.0. -->
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<application
<uses-library android:name="com.google.android.maps"/>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" />
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<meta-data android:name="com.google.android.backup.api_key"
android:value="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" />
</application>
我在控制台上检查了API KEY并启用了Google Maps Android API v2。但所有的猴子工作。 此外,我尝试使用已签名的应用程序,但现在在服务器上发送的所有SHA1密钥都是正确的。
这个日志可能需要:
12-29 14:41:30.465: I/Google Maps Android API(27463): Google Play services client version: 5084000
12-29 14:41:30.465: I/Google Maps Android API(27463): Google Play services package version: 6599038
检查三星S4
解决方案: 似乎需要使用 导入com.google.android.gms 代替 导入com.google.android.m4b 对于地图