How to make Android Google Maps v2 work in android emulator

Nemanja Kovacevic
Nemanja Kovacevic
Published in
3 min readDec 6, 2012

Couple of days ago I was in for a nasty surprise. Providing android training in a company here in Belgrade I wanted to present a demo app of location sensors and Google Maps API but when I sat to prepare it I realized that only yesterday new Google Maps API v2 for android has arrived :) Not a problem really since I love learning and keeping up to date with changes but not beeing able to run maps powerd app in an emulator was a really unpleasent surprise. Read on to see how you can make this happen.

When you run an app with Map fragment in it on android emulator you will get a screen similar to the first one posted here. Since everything is going through Google Play Services now and they are being managed by Google Play Store it was obvious that the lack of Google Play Store on emulator has something to do with the issue. I followed that lead and tried to install Google Play Store on the emulator by instructions from this blog post and this blog post. It wasn’t a smooth experience however. Android system has a way of cleaning itself of “aliens” you are puting in it’s /system/app directory but with a help of snapshots I was able to install Google Pay Store and download a random app from it. But the maps still didn’t work. I could tap a button and it would take me to the store but I would get an “item not found” message.

A day after I started the same app in the same emulator by mistake and I was astonished to see that maps has loaded :) When I made a diff between the working and a clean emulator I found two APKs on the working one not present on the other: com.android.vending-1.apk and com.google.android.gms-1.apk This was strange to me because the day before I was pushing GoogleLoginService.apk, GoogleServicesFramework.apk and Phonesky.apk to /system/app and today they are gone and I found those two in /data/app. But hey, it’s working so I’ll run with it :)

Here’s how you can make it work:

1. Create a new emulator

  • for device choose “5.1'’ WVGA (480 x 800: mdpi)”
  • for target choose “Android 4.1.2 — API level 16”
  • for “CPU/ABI” choose “ARM”
  • leave rest to defaults

these are the settings that are working for me. I don’t know for different ones. Comment bellow if you’ve tried some different ones.

2. Start the emulator

3. Install com.android.vending-1.apk and com.google.android.gms-1.apk via ADB install command

Google Maps should work now in your emulator. Please comment is it working for you?

update no 1: People are reporting that this does not work on targets with Google APIs already installed, try it with clean android builds.

update no 2: Relevant permissions for Google Maps API enabled app (regarding one of the questions below):

<permission android:name="com.yourpackagename.permission.MAPS_RECEIVE" android:protectionLevel="signature"></permission><uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<uses-permission android:name="com.yourpackagename.permission.MAPS_RECEIVE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="yourAPIkeyHERE" />

--

--

Nemanja Kovacevic
Nemanja Kovacevic

Software engineer specialized in creating native android and iOS apps