Prerequisites:
1. Download “Google Play services for Froyo” or “Google Play services” from “Android SDK Manager”
– Google Play services: version 4.3.23
– Google Play services for Froyo : version 3.2.65

2. Obtain your Google Maps API v2 Key. (Refer guide: Get API v2 Key )
3. Android Support Library
Step 01:
1. Open a new Eclipse workspace.
2. Copy and paste google-play-service project from ..\android-sdks-update\extras\google to your current workspace

3. Right Click on Project Explorer –> Import –>Android –>Existing Android Code into Workspace –> Browse D:\AndroidWorkspace\google_play_services\libproject\google-play-services_lib –>Ok

Step 02:
1. Create your Android project with target
– Android API 4.2 or above (if you are using “Google Play services” project)
– Older Android API version (if you are using “Google Play services for Froyo”)
*Note: Make sure the package name of your project is similar to the name used to generate the API v2 Key.
2. Reference the google-play-services-lib project from your project so that you can access it as a library:
Select the Project -> Properties -> Android -> Library: Add -> google-play-services_lib

Step 03:
1. MainActivity.java
package com.test;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
public class MainActivity extends FragmentActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
2. activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
3. AndroidManifest.xml
– Add openGL ES requried <uses-feature>; this is required to view the Google maps v2 since this feature supports from OpenGL ES version 2.0 and above
– Add required <uses-permission>
– Add API key as <meta-data>
*Note:
If you are using the “Google Play services” library project (not the Froyo), add the following meta-data tag to AndroidManifest.xml file, inside <application> element. This will automatically find the google-play-services-version, if you have referenced the library project correctly.
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.test"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="9"
android:targetSdkVersion="17" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="<your API_KEY>" />
<activity android:name="com.test.MainActivity" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Deploying..
Since the Google maps v2 required OpenGL ES version 2.0 or above on your device to view the Maps; You will not see the maps on the normal Emulators. It is recommended to test the application on Actual devices, rather than using virtual devices.

You will see the Google maps on the right device as follows.

For the moment,
– Refer the guide Genymotion Virtual Device and install Genymotion
– Install Google Play on Genymotion referring this post.
You’ll be able to view the Google Maps on your GVD.
Thank You 🙂
Like this:
Like Loading...