Date Created: Sun 15-May-2011

Related Document Categories:

Get my WebSphere Application Server course here >>

Creating a Google Maps key for your development version of Android application

1. Ensure path to JDK is available to your Android SDK promot

Set winwdows path to include something like:

If you can run Javac then you have correctly defined the path

2. Run Keytool to generate key using this command:

keytool -list -alias androiddebugkey -keystore "C:/Users/Steve Robinson/.android/debug.keystore" -storepass android -keypass android

Replace the "C:/Users/Steve Robinson/.android/debug.keystore" with your SDK default keystore path

Tip use Windows > Preferences in Eclipse IDE and navigate to Android > Build an look for the Default debug keystore value, this will tell you where your debug keystore is located


When you are ready to register for a Maps API Key, load this page in a browser: com/android/maps-api-signup.html

To register for a Maps API Key, follow these steps:
1. If you don't have a Google account, use the link on the page to set one up.
2. Read the Android Maps API Terms of Service carefully. If you agree to the terms, indicate so using the checkbox on the screen.
3. Paste the MD5 certificate fingerprint of the certificate that you are registering into the appropriate form field.
4. Click "Generate API Key"

The server will handle your request, associating the fingerprint with your developer identity and generating a unique Maps API Key, and then will return a results page that gives you your Key string.

To use the Maps API Key string, copy and paste it into your code as described in the next section.

Note: If you happen to forget your Maps API Key, you can generate a fingerprint for your certificate and register it again. The registration server will give you the same Maps API Key for the specified certificate fingerprint.

Adding the Maps API Key to your Application

Once you've registered with the Google Maps service and have obtained a Maps API Key, you must add it to your application's MapView objects, so that the Maps server will allow them to download Maps tiles.

Now that you have the api key, you can use it in the main.xml layout file of your MapTest application. Here's what mine looks like:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android=""



Note: For MapView objects instantiated directly from code, pass the Maps API Key string as a parameter in the constructor. For example:

mMapView = new MapView(this, "example_Maps_ApiKey_String");

Final Steps to Enable MapView Elements

If you've added the Maps API Key to the MapViews in your application, here are the final steps to enable the MapView elements to run properly:

  • Make sure that you added a <uses-library> element referencing the external library. The element must be a child of the <application> element in the application's manifest. For example:

<manifest xmlns:android=""
<application android:name="MyApplication" >
<uses-library android:name="" />
  • Sign your application with the certificate that corresponds to the Maps API Key referenced in your MapView elements.
Eclipse Users

If you are developing in Eclipse/ADT (and have set up Keytool as described above), signing in debug mode is enabled by default. When you run or debug your application, ADT signs the .apk with the debug certificate, runs zipalign on the package, then installs it on the selected emulator or connected device. No specific action on your part is needed, provided ADT has access to Keytool.


Get my WebSphere Application Server course here >>

Steve Robinson - IBM Champion 2013

About Me

Steve Robinson has been working in IT for over 20 years and has provided solutions for many large-enterprise corporate companies across the world. Steve specialises in Java and Middleware.

In January 2013, I was awarded the prestigous 'IBM Champion' accolade.

  • Linked In
  • Twitter
  • About Me
  • My Blog
  • Contact Me

Read my books?

IBM WebSphere Application Server 8.0 Administration Guide

IBM WebSphere Application Server 8.0 Administration Guide

WebSphere Application Server 7.0 Administration Guide

WebSphere Application Server 7.0 Administration Guide

WebSphere Categories

Other Categories