Subscribe via RSS Feed

Running Google Android Map V2 on Android Froyo and later

March 9, 2013 0 Comments


In this tutorial I’ll discuss that how to create a basic Android application which uses the Google Android Map V2. This application will run on any Android device running Android version 2.2 and later.

Install/Update Android SDK with Google Play services :

I am assuming that you already have installed Android SDK and Eclipse. Please update your SDK so that ‘Google Play services’ is installed and updated. Please find the following image for reference. (Here, in my case, it was installed but not updated, so I updated it.)

Android SDK Manager

Import ‘Google Play services’ Library to workspace :

After the completion of Android SDK update import Google Play services library into your workspace using Eclipse menu File → Import → Existing Android Code Into Workspace and browse to the Google Play services library location (your Android SDK location/extras/google/google_play_services/libproject/google-play-services_lib) and select it.

Please find the following image for your reference.

Import Projects in Eclipse

Create New Android Project into the workspace :

Create a new Android project into the workspace from Eclipse menu File → New → Android Application Project. Please find the following image for your reference.

New Android Application

Add the Google Play services library to the project:

Add the newly imported Google Play services library into the project from File → Properties menu. Refer to the following image :

Screenshot from 2013-03-09 14_57_15

Create Google Map API Key for the application :

Now we need to create a API key for this application. For details about the procedure of creating a new API key please visit to this link.

Modify Manifest.xml file :

Modify the existing Manifest.xml file according to the following :

Screenshot from 2013-03-09 15_09_35

Modify the main layout file :

Modify the main layout xml file according to the following :

Screenshot from 2013-03-09 15_14_06

Please note that here we have used SupportMapFragment rather than using MapFragment in order to run it on Android versions prior to 3.0.

Modify the main Activity :

Now modify the main Activity file according to the following :

Screenshot from 2013-03-09 15_37_53

Please note that here the main activity extends FragmentActivity class rather than Activity.

Run the application on Android device :

Now run the application on an Android device running Android 2.2 or later. Refer to the following image which shows the output:
SC20130309-152832

That is it. Please comment, if you find anything more useful.

Enter your email address:

Delivered by FeedBurner