谷歌地图API V2“无法加载地图。无法联系谷歌服务器“地图、加载、服务器、API

2023-09-12 00:37:04 作者:-=金榜提名=-

我已经检查和双重检查我的APIkey,我在谷歌Console注册但我仍然得到以下错误:

I have checked and double checked my APIkey that I registered on the Google Console however I am still getting the following error:

12-05 16:31:12.940: E/Google Maps Android API(12334): Failed to load map.  Could not contact Google servers.

我所看到的是放大/缩小按钮和背景的MapView但没有地图??? !!!

What I am seeing is the zoom in/out buttons and the background for the MapView but no Map???!!!

任何想法???

答案

我将它张贴在这里,因为有什么解决了我的问题在下面的接受的答案的评论说。

I will post it here because what solved my issue was stated in the comments of the accepted answer below.

这是 READ_GSERVICES 许可。出于某种原因,权限的开发者网站中没有提到,当它来使用它们。

It was the READ_GSERVICES permission. For some reason the permission wasn't mentioned on the developer site when it came to using them.

推荐答案

有关设置谷歌地图API第2版Android上,确保您已完成的所有以下步骤。

For setting up Google Maps API v2 on Android, make sure that you have completed all of the following steps.

APP键API访问权限

当谷歌要求你的应用程序的证书的SHA1指纹,你会想最有可能要为你的debuging证书运行此两次,一次,一次为您发布证书。

When Google asks for the SHA1 fingerprint of your app certificate, you will want most likely want to run this twice, once for your debuging certificate, and once for your publishing certificate.

密钥工具-list -v -keystore publishcert.keystore   密钥工具-list -v -keystore〜/ .android / debug.keystore

keytool -list -v -keystore publishcert.keystore keytool -list -v -keystore ~/.android/debug.keystore

在市场上的应用程序的指纹不同,那么一个应用程序,你只是测试指纹!

启用对谷歌API控制台服务

登录到谷歌API控制台。 在服务页面上,找到谷歌地图Android的API V2

Login to the Google API Console. On the services page, find Google Maps Android API v2.

注意的 - 谷歌地图API V2 是不同,然后谷歌地图Android的API V2

在API访问选项卡,单击创建新的Andr​​oid按键

In the API Access tab, click Create new Android Key

添加您的证书签名,访问的API。

Add your certificate signatures for access to the APIs.

yourrelease指纹; com.example.project.package   yourdebug指纹; com.example.project.package

yourrelease-fingerprint;com.example.project.package yourdebug-fingerprint;com.example.project.package

您将提供一个生成的API访问密钥。

You will be provided with a generated API Access Key.

您可能需要首先创建了API控制台的API项目

修改应用程序清单

添加您的API密钥,里面的<应用> 元素

Add your API Key, inside of the <application> element.

<meta-data
    android:name="com.google.android.maps.v2.API_KEY"
    android:value="yourapikey"/>

添加以下权限:

Add the following permissions:

<permission
        android:name="com.example.project.package.permission.MAPS_RECEIVE"
        android:protectionLevel="signature"/>

<uses-permission android:name="com.example.project.package.permission.MAPS_RECEIVE"/>

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>

添加以下功能要求:

Add the following feature request:

<uses-feature
    android:glEsVersion="0x00020000"
    android:required="true" />