Google map signed api key errors in Android
Asked Answered
S

10

63

When I switched from my debug map key to my signed map key my maps stop working. I get the following errors in logcat:

09-03 18:18:04.112: WARN/System.err(4073): IOException processing: 26
09-03 18:18:04.112: WARN/System.err(4073): java.io.IOException: Server returned: 3
09-03 18:18:04.112: WARN/System.err(4073):     at android_maps_conflict_avoidance.com.google.googlenav.map.BaseTileRequest.readResponseData(BaseTileRequest.java:115)
09-03 18:18:04.112: WARN/System.err(4073):     at android_maps_conflict_avoidance.com.google.googlenav.map.MapService$MapTileRequest.readResponseData(MapService.java:1473)
09-03 18:18:04.112: WARN/System.err(4073):     at android_maps_conflict_avoidance.com.google.googlenav.datarequest.DataRequestDispatcher.processDataRequest(DataRequestDispatcher.java:1117)
09-03 18:18:04.112: WARN/System.err(4073):     at android_maps_conflict_avoidance.com.google.googlenav.datarequest.DataRequestDispatcher.serviceRequests(DataRequestDispatcher.java:994)
09-03 18:18:04.112: WARN/System.err(4073):     at android_maps_conflict_avoidance.com.google.googlenav.datarequest.DataRequestDispatcher$DispatcherServer.run(DataRequestDispatcher.java:1702)
09-03 18:18:04.112: WARN/System.err(4073):     at java.lang.Thread.run(Thread.java:1019)

I've double checked everything, permissions and library are in place. I've recreated the singed key and no luck.

Any ideas?

Seize answered 3/9, 2011 at 23:28 Comment(4)
Post the code where the exception is thrown.Spathe
i had the same problem, it worked once, then every time after, ran, but only loaded a gray grid and came up with the same errors you posted.Excreta
You know you should accept the answer that worked for you :)Coon
@SagarHatekar Lol, I know! I'm on here all the time just haven't logged in a forever obviously.Seize
C
86

I had the same problem and I figured there wasn't any helpful answer around on the internet so hoping this should help everyone in the future.

When using GoogleMaps for Android, you need two keys - debug and release.

The "debug" key is kind of a misleading term. This key is also to be used when you develop the app in Eclipse. So essentially, use the debug key for development, testing, debugging.

When you're ready to launch the app to Market, set the android:debuggable="false" in the AndroidManifest.xml and use the Signed API key.

When using the signed API key, the MapView will show up ONLY when the app is installed from the Android Market. So, installing the app from Eclipse (Run As, Debug As, etc) or command line (adb install) won't show the MapView. Rest assured, once the app is in the Market - you download it and the MapView will show up.

With the signed API key, if you deploy the app from Eclise, you will get a "Server returned 3, IOProcessing Exception 26" as a warning - just ignore it.

Note: Also ensure there are no duplicate instances of the same MapView. If your app needs "x" no. of MapViews, generate "x" no. of new signed keys (one for each MapView) since GoogleMaps has a query limit for a single MapView instance.

For getting both the keys, follow the steps for Obtaining API keys for GoogleMaps on Android.

Happy Coding!

UPDATE:

The link above for obtaining api keys is now a deprecated procedure. Refer Obtaining API keys for GoogleMaps Android API v2 going forward.

Coon answered 24/1, 2012 at 15:21 Comment(8)
I don't know how you can create more than 1 GMaps API key per app. AFAIK, GMaps API key is associated with .keystore (which you use to sign your app). It means for each app, you can create only 1 GMaps API key.Donella
Hmm..you have a valid point. Maybe you generate multiple signed keys? Although I am not sure if the signatures would be unique.Coon
Just to be accurate: "When using the signed API key, the MapView will show up ONLY when the app is installed from the Android Market. So, installing the app from Eclipse (Run As, Debug As, etc) or command line (adb install) won't show the MapView. Rest assured, once the app is in the Market - you download it and the MapView will show up." - this is not really correct. In fact, the MapView will work as intended if the app is signed with the key you gave to Google when applying for a Maps key. You can install from the command line and it will work if you signed it with this one.Springtime
I was confused about that issue... we had a working map for our client, but it was working regardless of being installed from market or from other source. And one day we recognized that it did not work any more. Indeed, we had to change our signing certificate, and we missed to give it to google again...Anguilla
@Sagar Are you saying that we cannot see MapView in debug mode anymore?Tishatishri
@Tishatishri You can view the MapKey in debug mode, if you use debug key.Coon
How I can rest assured if exactly the same symptoms are in the "bad key" situation? Or how I can tell that for sure?Gstring
Note that debuggable false is not necessary in some cases if I interpret this correct: https://mcmap.net/q/121639/-android-39-debuggable-39-default-valueTsimshian
B
3

Finally Its fixed.

I am using Windows machine, so I simply went to C:\Users\rohit\.android and deleted debug.keystore and default.keyset1 once this is done, I went to Eclipse and applied a clean build to my project and its done!

Betthezel answered 17/1, 2012 at 18:15 Comment(0)
D
2

Signed map key is used for release app. So you will get such info. if you debug the app via USB-tethered with signed map key. Switch back to debug map key if you want to debug the app, and replace it with signed map key before you release an update or new version.

Deft answered 12/1, 2012 at 23:20 Comment(2)
yes, signed API key is for release. with this key, the mapview will show up only when you install the from the market.Coon
It doesn't matter from where (market/play, sideload...) you got the apk. It only matters that it is signed with the right key.Protection
H
2

I had the same problem. In my case, what I was doing wrong was this. I was writing the keytool command like this:

keytool -list -keystore debug.keystore ...

instead of:

keytool -list -keystore ~\.android\debug.keystore ...

So I wasn't updating the Eclipse's keystore with my fingerprint.

I hope this helps someone :)

Herman answered 4/4, 2012 at 7:41 Comment(0)
A
2

If you are using a debug key that somebody else has generated and provided to you, that is the reason for the blank map with the following exception.

java.io.IOException: Server returned: 3

You can use this link to get an API key : https://console.developers.google.com/apis/credentials

This link will take you to google credentials page, the new place to get API keys.

Apocynthion answered 11/9, 2012 at 19:1 Comment(1)
what do you mean by debug key? debug keystore or maps key?Compartmentalize
S
1

I just encountered exactly the same problem.

There is no user-written code that throws the Exception: it is generated in the Eclipse logcat and the result is that you do not see any of the Google map tiles. Like Jen, I regenerated the key, to no avail.

The platform is Android 3.2, the device is the Asus Transformer, the connection is WiFi.

FYI my Android 2.2 application works fine, retrieving the map on a Droid over 3G.

Here is the solution to my problem, hope it helps Jen:

In my case, if I install the release version onto the Transformer using the "Debug as" Eclipse icon, with the Transformer USB-tethered, the map is failing as described above (FYI this is a procedure I have used successfully many times with Android 2.2 and other devices).

So I tried this instead: I use the Eclipse File|Export... option to create a release APK, and then install that APK onto the Transformer using its Asus Sync application. Everything is fine. The map tiles appear.

Saddlebacked answered 4/9, 2011 at 11:16 Comment(4)
You're right it's not a code issue. I've tried creating keys in different apps, under different gmail accounts and still the same error. I thought maybe it was my device, a HTC G2 running Anroid 2.3, then I tried using the emulator with different Android apis and no luck there either. I tried your suggestion and installed the apk to my device using AstroFile and the problem is still there. Thank you though, it's good to hear that I'm not the only one getting this error. The only other thing I can think off is moving my project to another computer and trying again.Seize
Did you also regenerate the MD5 fingerprint? In my case the MD5 changed so I had to get a new Maps API key.Saddlebacked
Yes I did regenerate the MD5 fingerprint and still the same error.Seize
very interesting, i started having these symptoms this morning. until then, the code was working fine. could my key have expired? will check and post.Trochophore
D
1

one more thing: After adding -v you must remember that the google API just need MD5 not SHA1.So please check what code you give to google.

Dunkirk answered 18/9, 2012 at 9:43 Comment(1)
Then why does Google say: Google verifies that each request originates from an Android application that matches one of the certificate SHA1 fingerprints and package names listed below. You can discover the SHA1 fingerprint of your developer certificate using the following commandTishatishri
A
0

I have same question but I think I found the answer!

  1. Decide follow these step https://developers.google.com/android/maps-api-signup and receive your certificate's MD5 fingerprint
  2. While development, if map's not showed, don't worried about this! Simple extract APK use android tools with key tool which's used in first step and use this APK file to install on your phone, you will see MapView

Anyway, while development time, maybe you don't see MapView, but it's till not problem and don't worried about this! Simple wait when finished app & build with your keystore and you will see map display correctly

Atmo answered 8/5, 2012 at 3:31 Comment(0)
T
0

For the poor souls that tried to build the map example from sdk extras: as soon as I renamed the package from com.example.mapdemo to com.mynmae.mapdemo, the map magically appeared. Yes, I lost an hour searching and trying and it silently rejected the package name.

Tractable answered 17/10, 2013 at 20:25 Comment(0)
M
0

I'm from the future! I've experienced the exact same problem. But this might be an issue for novice developers.

When you created a new google maps activity in the android studio, there's a link to get yourself an API key inside the google_maps_api.xml file. So what happens when you follow this link is that Google will create a "debugging" key for your project. Which, as Sagar Hatekar explained, is indeed, only meant for testing and dev.

To be more clear, Google identifies your project by the SHA-1 certificate fingerprint (also stated inside the comments of google_maps_api.xml) So what I'm trying to say is that you CANNOT use the same key for several projects unlike the open/public APIs out there.

https://developers.google.com/maps/documentation/android-sdk/start

In this link, they have a small section with the topic of A slightly less fast way which might be a try to explain this phenomenon.

Therefore, if you are using the same key for a project which, the key is not meant for, try requesting a new key.

Mannerheim answered 27/7, 2020 at 7:36 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.