Saturday, May 21, 2011

Google Map View API Registration (MD5 Fingerprint + Key Signup)

I encountered this problem when I was learning Google Map View tutorial example for AndroidGoogle provides its own tutorial about Obtaining a Maps API Key, but for those like me,who were not that familiar with Java key generation, I think it's a bit hard to understand.So here are some notes about it and this is all based on Windows 7.

1. Finding Keytool: 

Keytool is an executable file that comes with JDK. Running this tool under command prompt will give you the MD5 finger print. The JDK folder locates at where you installed Java and you can usually find the keytool under the bin folder. This is the path where I found mine

C:\Program Files\Java\jdk1.6.0_25\bin


2. Generating release keystore:

Open command prompt through "Start - Run - input 'cmd'", cd to the JDK bin folder. Then input the following command where you can replace alias_name and release_key to whatever you like

keytool -genkey -v -keystore release_key.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 10000

After you pressing Enter, the program will ask you several questions and some passwords. You will find your release_key.keystore in the bin folder. Note that you are generating this key for releasing, if you just want to sign your debug certificate, you can find the debug.keystore under this path

C:\Users\Your_Win7_Username\.android

3. Getting the MD5 Fingerprints:


Now you can get your MD5 fingerprints by executing the following command


keytool -list -keystore release_key.keystore

The program will ask you for password, which should the keystore's password. At the end, your MD5 fingerprints should look like this


94:1E:43:49:87:73:BB:E6:A6:88:D7:20:F1:8E:B5:98

When getting your debug.keystore's MD5 fingerprint, you'd better use the following command as suggested on Google's site


keytool -list -keystore debug.keystore -storepass android -keypass android




4. Map API Key signup


After you got your MD5 fingerprints, you can visit the sign up page to get the API key. With the key, you can develop your android program with the Map view API.

Sources:
http://code.google.com/android/add-ons/google-apis/mapkey.html
http://developer.android.com/guide/publishing/app-signing.html
http://stackoverflow.com/questions/2997348/cant-find-the-android-keytool