Google Android MapView

Last time i tried to implement a tiny application that should be able to display a map on an Android phone. I found that the free use of maps is quite reduced to either use OpenStreetMap or Google Maps, even if these two solutions are not really comparable with each other. According to the fact that i had to deeply integrate the map into my Android App i choose to use the Google Android MapView solution. Here i describe what i had to do to get the MapView running within my application.

To get Google Android MapView working you need:

  1. The Google API Extensions installed
  2. Create a MapView with a valid Google Maps key that fits to your selected signing keystore
  3. To sign your application (either with the debug keystore or with your customized, personal keystore)
  4. To register the MD5 footprint of your keystore at Google Maps to get a valid Google Maps key

Installation Google API Extensions

The MapView user interface widget is not part of the general Google Android SDK. Instead it is part of an extension toolkit that is called ‘Google API Extensions’. You can install this Google APIs add-on by using the Android SDK and AVD Manager.

Open the Android SDK and AVD Manager within your Eclipse environment and select third-party add-ons to install. You have to select the Google Inc. add-ons for each demanded platform version. After the install process is finished you see following screen:

Now you open your application properties and set the Google Inc. add-ons as your new build target:

After you finished setting your new build target to the Google Ing. add-ons, the necessary Google MapView libraries are included within your project. So you can start using a MapView widget within your layout, as this example shows.

Use the Google MapView widget within your applications layout

Google MapView is not part of the default libraries, so you have to separately include them in your manifest file:

Additionally you have to allow Google MapView to access the Internet according to the fact that Google maps loads all the data from a central repository:

Now add the MapView widget to your custom layout (Note that within the Google Maps Key attribute you have to fill in your own key as you got it from the Google Maps page):

After you defined a new layout that uses the MapView widget you can create a new Activity just like this:

import android.os.Bundle;
import android.view.Window;
import android.view.WindowManager;


public class MyMapActivity extends MapActivity {

	/** Called when the activity is first created. */
    public void onCreate(Bundle savedInstanceState) {
		// set fullscreen


	protected boolean isRouteDisplayed() {
		return false;


Obtaining a Google Maps Key

Here you can register for a Google Maps Key.

Read this tutorial how to get the MD5 fingerprint of your certificate.

Without valid and registered Google Maps Key your MapView widget will show an empty canvas, just like this:

Frequent Errors:

AndroidRuntime : android.content.ActivityNotFoundException: Unable to find explicit activity class  have you declared this activity in your AndroidManifest.xml?

You have to declare your new activity class within your AndroidManifest.xml file

MapActivity: no class definition found

Maybe you have not defined the Google API add-on library within your AndroidManifest.xml, the declaration should reside WITHIN the application element:

System.err(985): Server returned: 3

You did not enter a valid and registered Google Maps Key. Please refer to the point above how to register for a Google Maps key.

Leave a Reply

Your email address will not be published. Required fields are marked *