简体   繁体   English

Google Maps android中的错误“android无法加载地图。 无法联系Google服务器。“

[英]Error in Google Maps android “android Failed to load map. Could not contact Google servers.”

i am trying to implement google maps in my android application but i am stuck on an error " android Failed to load map. Could not contact Google servers ." 我试图在我的Android应用程序中实现谷歌地图,但我卡在一个错误“ android Failed to load map. Could not contact Google servers 。” i have included google play library, got the key using SHA1 certificate fingerprint. 我已经包含谷歌播放库,使用SHA1证书指纹获得密钥。 i got the SHA1 certificate fingerprint as : 我得到了SHA1证书指纹:

 sudo keytool -v -list -alias androiddebugkey \-keystore /home/.android/debug.keystore

i managed my manifest file according to This 我根据This管理了我的清单文件

now i am unable to find the cause of this error.. any suggestion is greatly appreciated... 现在我无法找到此错误的原因..任何建议都非常感谢...

  • i have seen questions on stackoverflow but didnt got any solution! 我已经看到stackoverflow的问题,但没有得到任何解决方案!

EDIT : my manifest file permissions are as: 编辑 :我的清单文件权限如下:

<permission
    android:name="PAKG_NAME.permission.MAPS_RECEIVE"
    android:protectionLevel="signature" />

<uses-permission android:name="PAKG_NAME.permission.MAPS_RECEIVE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.com.google.android.providers.gsf.permission.READ_GSERVICES" />


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


.....................

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

and my layout xml have fragment as: 我的布局xml片段为:

  <fragment
            android:id="@+id/map"
            android:layout_width="match_parent"
            android:layout_height="100dp"
            android:layout_marginLeft="10dp"
            android:layout_marginRight="10dp"
            class="com.google.android.gms.maps.SupportMapFragment" />

Logcat output: Logcat输出:

 E/Google Maps Android API(31478): Failed to load map.  Could not contact Google servers.

Are you sure you have enabled "Google Maps Android API v2" and not "Google Maps API v2"? 您确定已启用“Google Maps Android API v2”而非“Google Maps API v2”吗? After changing that, delete and recreate the API key. 更改后,删除并重新创建API密钥。 This worked for me... 这对我有用......

Try right click on your project and select Properties > Android > and in "Project Build target" select Google APIs. 尝试右键单击您的项目并选择Properties> Android>,然后在“Project Build target”中选择Google API。 That worked for me :) 这对我有用:)

If you are sure about your API key, you should uninstall program from your phone and install again. 如果您确定自己的API密钥,则应从手机中卸载程序并重新安装。 It worked for me :) 它对我有用:)

Have u enable Google android map API v2 in console check It properly . 你有没有在控制台启用谷歌android map API v2检查它。 I think u enable Google map v2 that why request failed... 我想你启用谷歌地图v2,为什么请求失败...

You should check if you have duplicate API_KEY for the same project. 您应该检查同一项目是否有重复的API_KEY。 As you know, we will use sha1 key and android project name for getting an API key. 如您所知,我们将使用sha1键和android项目名称来获取API密钥。 If you try to use same sha1;android_project_name pair to get API key, Google will give you another API key. 如果您尝试使用相同的sha1; android_project_name对来获取API密钥,Google将为您提供另一个API密钥。 So its duplicated. 所以它重复了。 If you delete the newer one and use the older one in your project, it will solve your problem. 如果删除较新的并使用项目中较旧的那个,它将解决您的问题。 At least I hope :) 至少我希望:)

I had this problem when refactoring and changing my project bundle identifier. 我在重构和更改项目包标识符时遇到了这个问题。 If is this your case, you will have to create a new project on Google Developer Console and link again to your project. 如果是这种情况,您必须在Google Developer Console上创建一个新项目并再次链接到您的项目。 For some reason Google blocks requests from the same app if it changes its ID. 出于某种原因,如果Google更改其ID,则会阻止来自同一应用的请求。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 授权失败。 无法加载地图。 无法联系Google服务器。 (适用于Android的Google Map) - Authorization failed. Failed to load map. Could not contact Google servers. (Google Map for Android) Android地图:无法加载地图。 无法联系Google服务器 - Android Maps: Failed to load map. Could not contact Google servers “无法加载地图。 无法联系Google服务器。“ - “Failed to load map. Could not contact Google servers.” 修复无法加载地图。 无法联系Google服务器。 - Fix the Failed to load map. Could not contact Google servers. Google Maps Android API:无法加载地图。 与Google服务器联系时出错。 SSL固定实施后,这可能是身份验证问题 - Google Maps Android API: Failed to load map. Error contacting Google servers. This is probably an authentication issue after SSL Pinning implementaion Android版Google地图。 无法加载地图。 无法联系Google服务器 - Google Maps for Android. Failed to load map. Could not contact Google servers Google Maps Android API v2:无法加载地图。 无法与Google服务器联系 - Google Maps Android API v2: Failed to Load Map. Could not contact Google Servers Google Maps API V2&#39;无法加载地图。 无法联系Google服务器 - Google Maps API V2 'Failed to Load Map. Could not contact Google Servers' 无法加载地图。 无法联系Google服务器 - Failed to load map. Could not contact Google servers 无法加载地图。 无法联系Google服务器 - Failed to load map. Could not contact Google servers
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM