How to make Android Google Maps v2 work in android emulator

Author is a professional software developer providing android development services. More info here.

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" />
Be Sociable, Share!

69 thoughts on “How to make Android Google Maps v2 work in android emulator”

  1. i tried the same configuration as you wrote : Android 4.1.2 API level 16 (clean no Google APIs), installed both APKs with success, but my app did not work with this log :
    12-07 13:25:36.418: E/PackageManager(150): Package mypackage requires unavailable shared library com.google.android.maps; failing!

    so I reverted to target : Google APIs level 16 on my emulator and tried to run my app. It started but in the place where the map should be is displayed: “Unknown issue with Google Play services” and log is showing:
    12-07 13:32:25.857: W/GooglePlayServicesUtil(817): Google Play services signature invalid.

    and when I tested with isGooglePlayServicesAvailable() I get result 9 witch stands for SERVICE_INVALID which means according to API docs:
    The version of the Google Play services installed on this device is not authentic.

    1. Just a thought, but it might be that you get error “Package mypackage requires unavailable shared library com.google.android.maps; failing!” because you have “” in your AndroidManifest.xml (that library was needed on old Maps API, but not anymore on v2).

  2. I installed Android 16 Intel Atom x86 image and ran:

    adb shell mount -o remount,rw -t yaffs2 /dev/block/mtdblock0 /system
    adb shell chmod 777 /system/app
    adb install C:UsersGiliDesktopcom.android.vending-1.apk
    adb install C:UsersGiliDesktopcom.google.android.gms-1.apk

    When I tried running Google Play it complained I wasn’t logged in. So I ran:

    adb install GoogleLoginService.apk

    This allowed me to log into Google Play but it kept on crashing with:

    12-10 01:26:11.324: E/DatabaseUtils(1562): java.lang.SecurityException: Permission Denial: reading com.google.android.gsf.gservices.GservicesProvider uri content://com.google.android.gsf.gservices/prefix from pid=1912, uid=10043 requires com.google.android.providers.gsf.permission.READ_GSERVICES, or grantUriPermission()

    Any ideas?

  3. @Gill

    You didn’t read carefully, there was no need for remounting partition and changing permission, since you are installing apps not pushing fies… Nevermind, what seems to be your problem is standard android permission so the trouble is in your AndroidManifest.xml See the update no 2. on the end of the post and you will find the declaration of permission you are seeing in logs…

  4. Nemanja,

    Let’s go step by step:

    1. Create a new emulator: Galaxy Nexus, API level 16, Intel Atom (x86), Use Host GPU (all other settings are default). I know these aren’t the same settings as you mentioned but bare with me because the following error message doesn’t look CPU specific.
    2. Launch the emulator using: “emulator -avd -partition-size 500 -no-audio -no-boot-anim”
    3. adb install com.android.vending-1.apk
    4. adb install com.google.android.gms-1.apk
    5. So far so good. Now, try launching “Play Store”. This will fail with:

    W/Finsky(1442): [1] FinskyApp.getCurrentAccount: No account configured on this device.

    I assume I need to fix this warning in order to proceed? Any ideas?

  5. Thanks a lot but this solution no longer works :(
    Google just set an update for Google Play services on the SDK Manager (Rev. 4) that causes a warning: “Google Play services out of date. Requires 2012100 but found 2010110” and the aplication shows again the blank screen telling you to update Google Play services =S

      1. I am also getting this error, I havent found a way to update the Google Play Services to use this new version, nor have I found a way to set the packages such that it can use the old 2010110 version.

        Any help you can provide would be greatly appreciated

  6. it works on Android 4.1.2 – API level 16 , but i need to make it working on Google API Level 16 , the problem here that there already Goolge Play services installed so i’m looking for the way to update not to install . Help me Please

  7. I don’t think you can update because the versions you have are newer. Maybe you should try to delete apks with the same name and then push new ones?

  8. It works on clean “Android 2.3.3” emulator (no Google APIs). I used the .apk files from danbrough’s answer here: http://stackoverflow.com/a/13869332/1948704 (for Play Services rev.4).
    LogCat reports some warnings/errors(?) like “Could not find class ‘maps.j.k’, referenced from method maps.y.ae.a”, “Failed to find provider info for com.google.settings” and “Failed to find provider info for com.google.android.gsf.gservices”. But hopefully this is nothing serious (or at least I hope so).

    I also tried on “Android 2.3.3 Google APIs” but was unable to install the .apk files.

    Thank you Nemanja for this solution!

    1. Didn’t work for me. I tried both with 4.1.2 and 2.3.3 and relative apks, both reporting “Google Play services out of date. Requires 3136100 but found 2012110”

  9. my emulator say: “This app won’t run unless you update Google Play Services.” . how to fix that? i think the reason is google out of date

  10. Dude, i follow all the steps and when i run my app for test i receive the message “This app wont run unless you update Google Play Services”, than i click in update and PlayStore opens and closes.
    What can i do for solve this problem?

  11. Sorry, map just blinks and gone immediately for me.I don’t no why.
    Now i again received an error “Google play services out of date.Requires 2012100 but found 2010110”. If anybody knows the answer then guide me.

  12. Steps:

    1) Create new emulator with next configuration:

    http://www.dropbox.com/s/nunuh9htu25qfpz/stackoverflow_1.png

    On other versions I was could not configure because have of various errors when installing the necessary applications.

    2) Start emulator and install following applications: GoogleLoginService.apk, GoogleServicesFramework.apk, Phonesky.apk. You can do this with next commands:

    2.1 adb shell mount -o remount,rw -t yaffs2 /dev/block/mtdblock0 /system
    2.2 adb shell chmod 777 /system/app
    2.3-2.5 adb push Each_of_the_3_apk_files.apk /system/app/
    Links to download apk files. (www.dropbox.com/sh/20hcf8kxdk19z3c/Ukc8uGnk7p) I have copied it from my rooted android device.

    GoogleLoginService.apk – http://www.dropbox.com/s/lfde3juixuy88rg/GoogleLoginService.apk

    GoogleServicesFramework.apk – http://www.dropbox.com/s/9kurwyhbbuecaea/GoogleServicesFramework.apk

    Phonesky.apk – http://www.dropbox.com/s/9x8924gtb52ksn6/Phonesky.apk

    3) Install on the emulator Google Play services and Google maps. I have an error 491, if installing from Google Play store. I uploaded apps to the emulator and run installation from it(You can use adb to install this). Links to apps:

    Google maps – http://www.dropbox.com/s/koo4wiwqg8agy8n/com.google.android.apps.maps-1.apk

    Google Play services – http://www.dropbox.com/s/bh058hbrelccfsr/com.google.android.gms-2.apk

    4) I success runned demo sample on the emulator after these steps.

    http://www.dropbox.com/s/d83i4jnsh4s2b9c/stackoverflow_2.png

  13. this is not working for me.It show’s message.check this Link ::”android – Google Maps API V2 Not work in Emulator – Stack Overflow”

  14. hello

    have anyone found a solution that make Gmap v2 work in emulator, I folow steps but I have a message telling me to update google play service.
    thanks.

  15. My emulator now throws a splash screen with “This app won’t run unless you update google play services.” message.And when I click update it again throws a splash screen and terminate immediately .Any help will be appreciated.

  16. I followed carefully the steps suggested and installed the apk’s ( and libGL.os !) but surprinsingly this error ocurred in runtime

    E/AndroidRuntime(845): Caused by: android.support.v4.app.Fragment$InstantiationException: Unable to instantiate fragment com.google.android.gms.maps.SupportMapFragment: make sure class name exists, is public, and has an empty constructor that is public

    why if I’ve installed the com.google.android.gms-1.apk ??? I wanna cry.

  17. I haved com.android.vending-1.apk and com.google.android.gms-1.apk, but I cant install in my computer. when I install in cmd like C:Users\Downloadsadb install com.android.vending.apk. it says that: “the system cannot find the path specified”, but I certain I put it in rigth place!!!

    1. Did you copy paste both the .apk files in your folder which contains adb ?? Better copy both of them and paste them in the folder containing adb of android sdk. Then start command prompt and give this path and try again with :
      D:adt-bundle-windows-x86_64-20130219sdkplatform-tools>adb install com.android.vending-1.apk

      Thanks

  18. Pingback: Google Map Api v2
  19. Hello. i done all except adb install com.google.android.gms-1.apk. it says :

    C:UsersAdministratorDownloadsCompressedMy Eclipseandroid-sdk-windowsplatf
    orm-tools>adb install com.google.android.gms-1.apk
    EOCD not found, not Zip
    file ‘com.google.android.gms-1.apk’ is not a valid zip file
    rm failed for /data/local/tmp/com.google.android.gms-1.apk, No such file or dire
    ctory

    1. i am also facing same problem,

      EOCD not found, not Zip
      file ‘com.android.vending-1.apk’ is not a valid zip file
      rm failed for /data/local/tmp/com.android.vending-1.apk, No such file or directory…

      HELP me…!!!

      1. I’m getting the same exception as well…
        anyone successful in addressing this?

        adb install E:\Apps\
        Android\com.google.android.apps.maps-1.apk
        EOCD not found, not Zip
        file ‘E:\Apps\Android\com.google.android.apps.maps-1.apk’ is not a valid zip fil
        e
        rm failed for /data/local/tmp/com.google.android.apps.maps-1.apk, No such file o
        r directory

  20. Hej Nemanja,

    tvoje upute su uistinu korisne, ali evo nakon cijelog dana traženja, odlučio sam ti poslati ovu poruku. Naime, problem je što nigdje ne mogu naći apk za instalirati koji su verzija 3136100 koja meni treba. Tvoji ovdje referencirani su 2012nešto, a zadnje koje sam našao su 302nešto.
    Imaš li ideju kako natjerati emulator da ne traži zadnju verziju ili imaš li možda zadnju verziju na nekom uređaju?
    Unaprijed zahvaljujem,
    Zlaja

    1. Zdravo Zlajo,

      ja se nisam bavio ovim problemom otkad sam napisao ovaj članak, tako da nemam novije verzije niti novija saznanja. Ono što mogu da preporučim, a čega se možda nisi setio, je da pokušaš da sa nekog svog uređaja povučeš apk.

  21. i have installed both packages but still says

    “This app wont work unless you update google play services”
    Android version:4.2.2

  22. i can try these method but failed!!!!When try to install “adb install com.android.vending .apk ” and “adb install com.google.android.gms.apk” give a message:
    error: more than one device and emulator
    – waiting for device –
    error: more than one device and emulator
    – waiting for device –
    error: more than one device and emulator
    – waiting for device –
    error: more than one device and emulator
    – waiting for device –
    (continuously)

  23. After I originally left a comment I seem to have clicked on the -Notify me when new comments are added- checkbox
    and now each time a comment is added I get 4 emails with the exact same comment.
    There has to be a way you can remove me from that service?
    Cheers!

  24. How to install ?
    adb shell mount -o remount,rw -t yaffs2 /dev/block/mtdblock0 /system
    adb shell chmod 777 /system/app
    adb push Each_of_the_3_apk_files.apk /system/app/

    I don’t understand ,Can you Capture your install adb ?

  25. Your post was really useful, my task app was not working properly, it was working for the first time, next time onwards if i try to debug i was getting the below service name displaying in my log cat, i just read ur article and i tried the below permission, it worked well .

    Thanks lot

  26. i have done all the steps to said,but still now i got the message as upate google play service to run app… ,how to solve this isssuee..

Leave a Reply

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