3

I have checked a lot of questions around map tiles not loading on android device. I have not been able to fix the same error I have.

  1. I am able to test on both emulator and device my mapsview in my application with the debug key. It works absolutely fine. I had generated a maps api key for my debug certificate.

  2. I then created a maps api key for my release certificate with its MD5. I have added that to my maps view and now the application is not working.

    • I have added android internet permission in the correct place in manifest file.
    • I have correctly generated the MD5 finger print as I did for debug key.
    • I have only one mapview in my app so I have just changed that api key in the layout xml.
    • Only difference in generating key for debug and release is this: In the command options for keytool for the release certificate I was asked passsword only once which I presume is the store pass. my key pass was never asked (actually they are the same)

I generated debug keystore MD5 like this

$ keytool -list -alias androiddebugkey \
-keystore <path_to_debug_keystore>.keystore \
-storepass android -keypass android

I created the release key MD5 like this

 $ keytool -list -alias myalias_name -keystore "mykeystorepath"

I have also tested the app with the android store still no luck. What am I missing? Any help is greatly appreciated, thanks guys!

elenwe
  • 31
  • 2
  • Ok some more clarity on my question. My concern about the keytool not asking for a password second time is answered here. [link at oracle](http://docs.oracle.com/javase/6/docs/technotes/tools/solaris/keytool.html). --> Brackets surrounding an option signify that the user is prompted for the value(s) if the option is not specified on the command line. (For a -keypass option, if you do not specify the option on the command line, keytool will first attempt to use the keystore password to recover the private/secret key, and if this fails, will then prompt you for the private/secret key password.) – elenwe Oct 24 '12 at 13:24

2 Answers2

0

use eclipse for generating the key and exporting, also don't rely on the DEBUG variable( Android: automatically choose debug/release Maps api key? ) to switch at runtime the keys because that's broken at the moment, you have to export the app, get the md5, get the key based on this new md5, switch the map key, reexport

edit:

important steps of https://developers.google.com/maps/documentation/android/mapkey

1) $ keytool -list -alias alias_name -keystore my-release-key.keystore (NOT DEBUG KEY)
2) https://developers.google.com/android/maps-api-signup
3) update code with new key
4) clean project & build (important to clean, eclipse doesn't always do it)
5) export with eclipse
Community
  • 1
  • 1
max4ever
  • 11,909
  • 13
  • 77
  • 115
  • Thanks for the reply, but I quite did not understand what you meant. I am using no debug variable at the moment to switch between keys. After I finish my debugging and once i know the app is ready for release, (in eclipse) I use Android Tools -> Export Signed Package with the release keystore and key. Just before doing the export I change the maps key (wih the one for release) in the maps layout file. Could you please clarify where I am wrong? Thanks a lot. – elenwe Oct 23 '12 at 14:00
  • Once again thanks for clarity. I had/have done exactly what you have described. No luck yet. Any other way out? – elenwe Oct 24 '12 at 11:07
  • then the problem must must be in your "only asked password once for the release key MD5 " – max4ever Oct 24 '12 at 11:14
  • yeah I have used this signature and released apps in android store. I can't change it. Hope being asked the password once isnt a problem. It is still perplexing not sure what else could be wrong. – elenwe Oct 24 '12 at 13:03
  • I infact today wanted to check if the eclipse build was working correctly. So after exporting the signed apk I opened it up as a zip. I was able to view my layout file which correctly contained the release maps key. Then I verified the signature on the apk using jarsigner, that too pointed out the release certificate. I also checked the maps sing up page but as expected it gives the same maps key for the same MD5. – elenwe Oct 24 '12 at 13:07
0

Ok all, here is how silly it was. All was fine except for the fact that I placed the key in a layout file that I was not using. Probably I was out of my mind. So quickly

  1. The maps application will work with release key even if you just export signed application. It is not necessary that the application be put in Android store for it to work. There are some misleading comments in stack overflow that state this.

  2. The keytool will ask for password of the keystore and it will use the same to unlock the alias key too. Only if it is different it will ask again.

  3. The maps application with release key will work with emulator too. Just rmbr to use install adb ""

elenwe
  • 31
  • 2