Sunday, November 29, 2009

Android Mapping on an Emulator : API Key How To

So we've spent just over an hour trying to get maps showing up on our Android Emulator with messages like "ERROR/MapActivity(292): Couldn't get connection factory client" in the DDMS Logcat console (debug window). We were previously getting a grid that we could pan / zoom.

We have now solved it (by reading the docs). Apparently this isn't an uncommon problem so we've posted our solution here (Other than just reading the "
Getting the MD5 Fingerprint of the SDK Debug Certificate" section of the "Obtaining a Maps API Key page")

Please note: all values have been altered and will not work for you!!!

On vista where Bob is the user: (see the note at the bottom of this page on how to get the location)
cd C:\Bob\Android\SDK\.android\debug.keystore

Generate the Keystore with the same credentials as the emulator is going to use:
keytool -genkey -alias androiddebugkey -keystore "C:\Bob\Android\SDK\.android\debug.keystore" -storepass android -keypass android

List the fingerprint back from the keystore:
keytool -list -alias androiddebugkey -keystore "C:\Bob\Android\SDK\.android\debug.keystore" -storepass android -keypass android

Then use that fingerprint
at http://code.google. com/android/maps-api-signup.html to get your key - it also gives you a usage for your layout.

IMPORTANT NOTE:
The most important bit of the Obtaining a Maps API key page is the following:
If you are using Eclipse/ADT and are unsure where the debug keystore is located, you can select Windows > Prefs > Android > Build to check the full path, which you can then paste into a file explorer to locate the directory containing the keystore.

Hope this helps other Android Maps developers!

The Team.


1 comments:

Signs Christchurch said...

To techy for my blood but I could use an android...