Tuesday, May 26, 2009

Google Android - map not working in emulator? - how to fix it (in Windows) - by Alan Lupsha

Basically, you need a Google Mpas api key: http://code.google.com/android/add-ons/google-apis/mapkey.html

Example on how to do this:

1. find your debug.keystore file, for example:
C:\Documents and Settings\developer\.android\debug.keystore

2. list the md5:
C:\jdk1.6.0_13\bin>keytool -list -alias androiddebugkey -keystore "C:\Documents and Settings\developer\.android\debug.keystore" -storepass android -keypass android

androiddebugkey, May 18, 2009, PrivateKeyEntry,Certificate fingerprint (MD5): 83:4D:2C:6F:58:B3:D1:EA:2C:AF:0D:FC:70:19:57:D6

Save the fingerprint somewhere, you'll need it later.

3. Sign up for the maps API: http://code.google.com/android/maps-api-signup.html , use your generated MD5 fingerprint

Submission result:

Thank you for signing up for an Android Maps API key!

Your key is:
0h1d_-9Wwhaterver-your-key-is4yNt-SXgQ

This key is good for all apps signed with your certificate whose fingerprint is:
83:4D:2C:6F:58:B3:D1:EA:2C:AF:0D:FC:70:19:57:D6

Here is an example xml layout to get you started on your way to mapping glory:




Go to your project's layout, i.e. in main.xml, look for your MapView definition,
take out android:apiKey="apisamples" and replace it with whatever your key is,
for example: android:apiKey="0h1d_-9Wwhaterver-your-key-is4yNt-SXgQ"

or, if you didn't define your mapView in XML, but instead you did it in code, use:
mMapView = new MapView(this, "0h1d_-9Wwhaterver-your-key-is4yNt-SXgQ");

Also, make sure that in your manifest, you have this defined:

No comments:

Post a Comment