Thursday, March 22, 2012

Retrieving MD5 fingerprint by JDK 1.7 for generating Google Map API key

        When you develop Google Map API application on android platform, Google requires you sign your application with a Map API key and you need to include this key in your activity's layout xml. To signup Google Map API key, you need a Google account and a MD5 fingerprint. Basically, you need two fingerprints, one is for running your application on simulator, the other is for running your application on real Android device. Where do you get your finger print?

        If you use Eclipse, it signs your application with debug key storing in C:\Users\<your username>\.android\debug.keystore. The MD5 fingerprint of this debug key should be used to signup Google Map API key. For your release version, you should create your own release keystore file using JDK's keytool.exe in JDK1.7.0_01\bin folder. Once you have a keystore file, either debug or release, you can use keytool.exe to retrieve the MD5 from the keystore file.

        Retrieving MD5 fingerprint from keystore file on JDK 1.7 is a little bit tricky. You need to use the command like below to retrieve the MD5 fingerprint:

                keytool -list -v -keystore "[the path to your keystore file]"

         The tricky part is you must use "-v" to display all fingerprints, otherwise you only get the SHA1 fingerprint, which is not we need to signup Google Map API.

No comments: