Google Maps Android API v2: Failed to Load Map. Could not contact Google Servers

好久不见. 提交于 2019-12-30 18:09:09

问题


I'm trying to use Google Maps Android API v2, and I have already created the SHA1 key from my release cert.

I've read the comments from here and have made everything right, including the permissions for READ_GSERVICES which wasn't stated in Google's instructions here

However I'm still having the error of

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

Can anyhow enlighten me if I still have something left out?

I've included this as well:

<permission
      android:name="com.example.permission.MAPS_RECEIVE"
      android:protectionLevel="signature"/>
    <uses-permission android:name="com.example.permission.MAPS_RECEIVE"/>

and

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

in my applcation tag.

UPDATE: Just Managed to remove that error, realied that I typed my READ_GSERVICES wrongly.

However, now I'm having this problem:

01-24 16:58:08.628: E/Google Maps Android API(28025): Authorization failure.

What is causing this problem? my SHA1 is obtained from my release cert, is that wrong?


回答1:


Here's another thing to watch out for: I registered the same SHA1 hash with two different API projects. (Yes, I know this is silly, but I was experimenting with different ways to fix a problem.)

I mention this here, because you may have everything properly configured but you have MORE THAN ONE key for your project on Google's API console. (Here's hoping this silly mistake doesn't happen to you.)




回答2:


Did you solve the problem? May be this is the problem ->

Wrong service was enabled. Make sure the "Google Maps Android API v2", not "Google Maps API v2" is enabled and re-generate the API key. (https://stackoverflow.com/a/13805807/1300982)

If this is the problem, do not forget to Regenerate the API Key.




回答3:


As this time you are using

<permission
  android:name="com.example.permission.MAPS_RECEIVE"
  android:protectionLevel="signature"/>
<uses-permission android:name="com.example.permission.MAPS_RECEIVE"/>

are you sure that you package name is com.example, if not then replace com.example with actual package_name




回答4:


I had the same problem. I was using google maps api v1 key. I swithced it with google maps android api v2 key and problem solved.




回答5:


Make sure a different key is generated for different applications..




回答6:


I had the same problem and nothing worked. Then I have found Google Play Services in the Application Manager and cleared the data. Suddenly new API key started working!




回答7:


If you are using Xamarin remember to create the API key using the debug.keystore stored in:

Windows users: C:\Users[USERNAME]\AppData\Local\Xamarin\Mono for Android\debug.keystore

OSX: Users/[USERNAME]/.local/share/Xamarin/Mono for Android/debug.keystore



来源:https://stackoverflow.com/questions/14497179/google-maps-android-api-v2-failed-to-load-map-could-not-contact-google-servers

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!