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?

Community
  • 1
  • 1
lyk
  • 1,578
  • 5
  • 25
  • 49
  • I have a working example of a maps application at my git hub - feel free to take a look at the manifest. https://github.com/ChristopherTulip/MapHomeTest – chris-tulip Jan 24 '13 at 08:50
  • 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? – lyk Jan 24 '13 at 08:59
  • 1
    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 ;-) – Elmi Jan 24 '13 at 10:05
  • 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) http://developer.android.com/tools/publishing/app-signing.html#debugmode – chris-tulip Jan 24 '13 at 10:16
  • @Elmi thanks for the suggestion but I'm not doing it for myself so I have stricter requirements on using other sources, but thanks anyway =) – lyk Jan 24 '13 at 12:02
  • @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) – lyk Jan 24 '13 at 12:04
  • 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? – chris-tulip Jan 24 '13 at 12:09
  • 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 API – lyk Jan 24 '13 at 12:13
  • 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.keystore – xbakesx Mar 22 '13 at 20:16

7 Answers7

11

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.

Community
  • 1
  • 1
Hari Krishna Ganji
  • 1,647
  • 2
  • 20
  • 33
  • Thank you. This solved my issue. Overlooked that there are two separate apis:-) – Martin Nuc Mar 31 '13 at 15:23
  • Glad, I could help! I did the same mistake too. Thanks to @Doctoror Drive's answer in an other post. – Hari Krishna Ganji Mar 31 '13 at 19:02
  • 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! =) – lyk Apr 18 '13 at 08:25
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.)

Tim Crowley
  • 355
  • 4
  • 10
  • 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. – lyk Apr 18 '13 at 08:24
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

umesh
  • 1,148
  • 1
  • 12
  • 25
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.

Hadi Tok
  • 772
  • 8
  • 20
0

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

Liam
  • 27,717
  • 28
  • 128
  • 190
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!

David Vávra
  • 18,446
  • 7
  • 48
  • 56
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