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

7

7

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?

Tierratiersten answered 24/1, 2013 at 8:48 Comment(9)
I have a working example of a maps application at my git hub - feel free to take a look at the manifest. github.com/ChristopherTulip/MapHomeTestMammillary
Ah thanks that helped! Realized that I typed my READ_GSERVICES permission wrongly. Now I'm having error of "Authorization Failure"... so does this refer to my API key? I generated the SHA1 from my signed certificate... is that wrong?Tierratiersten
How about using a completely free solution istead of that tricky, proprietary thingy? "libwlocate" is not only for position evaluation using WLAN, the Android-classes also support GPS location, showing of/drawing into OSM/Google/satellite maps. And everythign without keys, hashes and auth-tokens ;-)Schwinn
Yes Auth failure is due to the API key - are you a using a test version or a published version of your app? While I was deving I had to recreate my project from existing code and ask google for a new API key I subbed in these values and they worked. For reference (though it doesn't recommend what I did) developer.android.com/tools/publishing/…Mammillary
@Schwinn thanks for the suggestion but I'm not doing it for myself so I have stricter requirements on using other sources, but thanks anyway =)Tierratiersten
@CTulip I'm very lost on how this works! I just deployed Version 1.0 on the google playstore. Now I'm working on the next by including map display, so I'm currently working on the codes which I've deployed previously. The API Key I generated was the one which I used to sign in the release mode. Is that wrong? (Just to clarify, I did it in Eclipse: ANdroid Tools --> Export Signed Application Package, and I created the keystore during that process)Tierratiersten
I'm sorry I haven't actually done this with a published app - my best advice is to make sure that the correct key is being used. I'm assuming that the Json object you're recieving is returning a "ACCESS_DENIED" string?Mammillary
Well I only have one .keystore file... I don't think I could use a wrong key =S Not exactly. The Activity loads a screen with no map with the zoom buttons, and on the logcat it shows the authentication failure error under Google Maps APITierratiersten
I hope you've resolved this issue by now, but if you haven't, you have two keystore files. One that your IDE (Eclipse and IntelliJ anyway) use for signing your development apks and your production keystore. The debug keystore (on Macs and linux types, probably a similar spot for Windows) is at ~/.android/debug.keystoreCoolidge
W
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.)

Weaponeer answered 7/4, 2013 at 11:57 Comment(1)
Sorry everyone for the late reply. As stupid as this seems, this was actually causing the problem! I needed one key for debug and one key for the autual deployment apk.Tierratiersten
G
11

Maybe 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://mcmap.net/q/67795/-map-api-v2-authorisation-failure)

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

Gratian answered 25/3, 2013 at 14:34 Comment(3)
Thank you. This solved my issue. Overlooked that there are two separate apis:-)Leadwort
Glad, I could help! I did the same mistake too. Thanks to @Doctoror Drive's answer in an other post.Gratian
Hi all, thanks so much for the help. As mentioned in the right answer, I actually got the keys of the debug and release mode mixed up, which caused the failure. I always had the correct service enabled. But glad that this answer helped solve your problems too! =)Tierratiersten
W
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.)

Weaponeer answered 7/4, 2013 at 11:57 Comment(1)
Sorry everyone for the late reply. As stupid as this seems, this was actually causing the problem! I needed one key for debug and one key for the autual deployment apk.Tierratiersten
C
1

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

Cumulous answered 17/4, 2013 at 11:7 Comment(0)
R
0

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.

Resplendent answered 10/4, 2013 at 8:32 Comment(0)
C
0

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

Coel answered 9/5, 2013 at 5:33 Comment(0)
S
0

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!

Sharitasharity answered 23/7, 2013 at 13:6 Comment(0)
F
0

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

Fable answered 24/7, 2013 at 21:42 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.