且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

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

更新时间:2023-01-11 14:48:05

有关设置谷歌地图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" />