How to install Google Maps v2 in Android Emulator and use it in Intellij Idea?

Integrating Google Maps (or any map service) is always a nice feature for our applications, but it seems to be “complicated” for integrating Google Maps because Google Maps is not officially supported in emulator because lacking of Google Play Service. That forces us to use a real device during developing app. For me, not nice. So in this post, I would like to show step by step how I configure my emulator so that a Google Maps app can be installed on there. To make such an emulator, we have to use a set of correct settings/files. If not, it won’t work. So you have to set all settings like mine. My emulator targets on Android 4.2.2 – API Level 17.

AVD Android 4.2.2

1. Install Google Play Service packages into emulator.

1.1 Start your emulator. Disconnect any other Android device (such as your smartphone) from computer.
1.2 Download these two files : :

1.3 Open command console, go to \platform-tools , it can be

C:\Users\ServusKevin\android-sdks\platform-tools or

Install two files above with command

adb install \
adb install \

If installation is successful, you’ll see message Success at the end

Vending Gms Installation Successful

If installation failed, see hints at the end of this post to solve your errors.

2. Download and configure the Google Play services SDK.

The Google Maps Android API is distributed as part of this SDK. The current version of Google Play service is r6. But don’t install it from SDK Manager. Our installed Google Play packages before is compatible only with r5. Therefore download Google Play services SDK r5 from this following link extract it to folder \extras\google . If you already installed r6, uninstall it. If not, you’ll get error “Google Play services out of date. Requires 3027100 but found 3025110”.

3.Obtain an API key.

You will need to register a project in the Google APIs Console, and get a signing certificate for your app.
3.1. Open command console, go to \bin , it can be

C:\Program Files\Java\jdk1.6.0_37\bin or
C:\Program Files (x86)\Java\jdk1.6.0_39\bin

Enter this command “keytool -v -list -keystore “. Please note that the  can be located at following folders

C:\Users\ServusKevin\.android\debug.keystore or

It depends on your IDE, default is in \.android\debug.keystore but in my case, is in \.android\debug.keystore. After running the command you’ll get SHA1 fingerprint

SHA1 Fingerprint

write down your SHA1 Fingerprint C7:04:A8:75:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx
3.2. Go to, create your project if necessary (find more info here Google Api Console register).  On the left of panel, go to API Access –> Create new Android key

Create new Android key

The syntax should be SHA1_Fingerprint;Package_Name_Of_Your_App . After creating a new key, an API key will be created, write down this new API key, you’ll need it for your Android app.

Android API Key

3.3. On the panel go Google API Console, go to Services –> Activate Google Maps Android API v2 (don’t be confused with Google Maps API v2)

Activate Google Maps Android  API v2

4. Create Android app to show Google Maps with Intellij Idea

4.1 Create an Android project. Please note that the package name is the name was used before at step 3.2.
4.2 Make reference to google-play-services, in Intellij IDEA, File –> Project Structure –> Modules –> Add –> Import Module

Intellij IDEA import module

Browse to \extras\google\google-play-services\libproject\google-play-services_lib –> OK –> Import module from external model (Eclipse) –> Next –> Next –> Finish. You’ll get one module more at the end.

Google Play Service Module

In Project Structure panel, click to choose your app module, go to Dependencies –> click on + –> Module Dependency –> Choose google-play-services_lib

Add Google Play Service lib dependency

In Project Structure panel, click to choose your app module, go to Dependencies –> click on + –> Jar or directories –> Browse to \extras\google\google-play-services\libproject\google-play-services_lib\libs –> Choose google-play-services.jar

At the end, you’ll get 2 dependencies in your app module

Google Play Service dependency

5. Specify settings in the Application Manifest.

5.1. Get the API Key and set it AndroidManifest.xml. Add the following element as a child of the element, by inserting it just before the closing tag :

 <meta-data  android:name=""

substituting your API key for YOUR_API_KEY.  This element sets the key to the value YOUR_API_KEY and makes the API key visible to any MapFragment in your application.

5.2. Specify more permissions in the Application Manifest like following

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

android.permission.INTERNET : Used by the API to download map tiles from Google Maps servers.
android.permission.ACCESS_NETWORK_STATE : Allows the API to check the connection status in order to determine whether data can be downloaded. : Allows the API to access Google web-based services.
android.permission.WRITE_EXTERNAL_STORAGE : Allows the API to cache map tile data in the device’s external storage area.
android.permission.ACCESS_COARSE_LOCATION : Allows the API to use WiFi or mobile cell data (or both) to determine the device’s location.
android.permission.ACCESS_FINE_LOCATION : Allows the API to use the Global Positioning System (GPS) to determine the device’s location to within a very small area.
 : Because version 2 of the Google Maps Android API requires OpenGL ES version 2. This notifies external services of the requirement. In particular, it has the effect of preventing Google Play Store from displaying your app on devices that don’t support OpenGL ES version 2.

6. Add Google Maps fragment to activity

<fragment xmlns:android=""

7. Show a Google Maps Marker on component

public class MainActivity extends Activity {

    private GoogleMap googleMap;
     * Called when the activity is first created.
    public void onCreate(Bundle savedInstanceState) {

        googleMap = ((MapFragment) getFragmentManager().findFragmentById(;
        final LatLng CIU = new LatLng(1.926, 73.400);
        Marker ciu = googleMap.addMarker(new MarkerOptions()
                .position(CIU).title("My dreamed island"));

Google Maps on emulator

So now you can show Google Map on your Android emulator. However maybe you will get some errors during setting up.

8. Common errors


To solve this error, follow these steps
– Keep your emulator on.
– In Intellij IDEA, menu Tools –> Android –> Monitor (DDMS included).

Intellij IDEA DDMS

– In Android Debug Monitor, go to File Explorer –> /data/system/packages.xml –> Save it to your computer (from button “Pull a file from the device” with disk symbol)
– Search to “” and delete all nodes below it (my case :  )
– Save it back to emulator through button “Push a file onto the device” with phone symbol.
– On emulator, click on turn off button (Basic Controls section) to reboot the device.


To solve this error, just uninstall the existing packages with command
– adb uninstall
– adb uninstall

8.3 You get a white blank Google Maps with 2 zoom buttons

Create a completely new AVD and follow the steps above again, be sure that you regenerate SHA1 key with your current debug.keystore. If you install new Android SDK, then you’ll need new SHA1 key and so new API Key. Remember when AVD was successfully created, don’t change its target to Google Api. It makes your AVD damaged and Google Maps won’t work anymore.

9. Updates

9.1 Updates 12.03.2015

– Pre installed AVD Image with Google Maps

Please note that you have to generate your SHA1 key and API key in AndroidManifest.xml so that Google Maps can be loaded

– Source code


  1. @Scarabaea: The picture with Module Dependencies is for the paragraph above. For jar file is the next paragraph.

    In Project Structure panel, click to choose your app module, go to Dependencies –> click on + –> Jar or directories –> Browse to extrasgooglegoogle-play-serviceslibprojectgoogle-play-services_liblibs –> Choose google-play-services.jar

  2. I installed the apks and managed to compile, the maps shows on my actual device, but it doesn’t work on my emulator.

    I used the apks you provided.

    Plz help 🙁

  3. @Gabriel: For emulator you have to install Google Play Services. Check Step 1 in the post to see how you can do that. The post is already written step by step. Just follow it.

  4. Thanks for your great work , i’ve got a problem in using adb ,
    i followed all the steps , but i’ve got an error ” Failure [INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES] ”
    i dont know what should i do , Thanks 🙂

  5. @Ahmed: It seems to be that you already have a another version of or installed in your AVD. Uninstall other version and try again.

  6. I am attempting to install Google Play Services for the emulator; however, I keep getting access denied. I’m not sure, how to deal with this problem :/

  7. @Carissa Samaroo: I can’t help you because your error description is not detailed enough so that I understand what’s going on.

  8. i followed all the steps , but i’ve got an error ” Failure [INSTALL_FAILED_INVALID_APK] ”
    iPlease tell me the solution , Thanks

  9. @Muhammad Asim Irshad : Check your steps again I think there’s a conflict between version of your Android OS and supported version of Google Play Services.

  10. Hello Admin,
    did you check the steps again? and did you find where is the error?

    best regards and a million thanks

Leave a comment

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