Running Google Maps v2 on the Android emulator

119,768

Solution 1

At the moment, referencing the Google Android Map API v2 you can't run Google Maps v2 on the Android emulator; you must use a device for your tests.

Solution 2

For those who have updated to the latest version of google-play-services_lib and/or have this error Google Play services out of date. Requires 3136100 but found 2012110 this newer version of com.google.android.gms.apk (Google Play Services 3.1.36) and com.android.vending.apk (Google Play Store 4.1.6) should work.

Test with this configuration on Android SDK Tools 22.0.1. Another configuration that targets pure Android, not the Google one, should work too.

  • Device: Galaxy Nexus
  • Target: Android 4.2.2 - API Level 17
  • CPU/ABI: ARM (armeabi-v7a)
  • Checked: Use Host GPU

...

  1. Open the AVD
  2. Execute this in the terminal / cmd

    adb -e install com.google.android.gms.apk
    adb -e install com.android.vending.apk
    
  3. Restart the AVD

  4. Have fun coding!!!

I found this way to be the easiest, cleanest and it works with the newest version of the software, which allow you to get all the bug fixes.

Solution 3

Please try the following. It was successfully for me.

Steps:

  1. Create a new emulator with this configuration: AVD configuration

  2. Start the emulator and install the following APK files: GoogleLoginService.apk, GoogleServicesFramework.apk, and Phonesky.apk. You can do this with the following commands:

    adb shell mount -o remount,yourAvdName -t yaffs2 /dev/block/mtdblock0 /system
    adb shell chmod 777 /system/app
    adb push GoogleLoginService.apk /system/app/
    adb push GoogleServicesFramework.apk /system/app/
    adb push Phonesky.apk /system/app/
    

    Links for APKs:

    1. GoogleLoginService.apk
    2. GoogleServicesFramework.apk
    3. Phonesky.apk AKA Google Play Store, v.3.5.16
    4. Google Maps, v.6.14.1
    5. Google Play services, v.2.0.10
  3. Install Google Play services and Google Maps in the emulator

    adb install com.google.android.apps.maps-1.apk
    adb install com.google.android.gms-2.apk
    
  4. Download Google Play Service revision 4 from this link and extra to folder sdkmanager->extra->google play service.
  5. Import google-play-services_lib from androidsdk\extras\google\google_play_services.
  6. Create a new project and reference the above project as a library project.
  7. Run the project.

Solution 4

I've successful installed Google Maps v2 on an emulator using this guide.
You should do the following steps:

Solution 5

I recommend using the emulator by Genymotion instead of Google's emulators. It launches way faster and responds almost in real-time. It also supports Google Play Services and therefore Google Maps.

Google Maps on Genymotion

Give it a try! Here is a blog post which helps you setting up the emulator.

Share:
119,768

Related videos on Youtube

Dawid
Author by

Dawid

Updated on June 15, 2020

Comments

  • Dawid
    Dawid almost 4 years

    I've tried to implement Google Maps v2 in my Android application, but unfortunately instead of maps I get this message:

    This app won't run without Google Play services which are missing from your phone.

    Is it possible to run these maps on the Android emulator (Platform 4.2)?

  • Dawid
    Dawid over 11 years
    Thank you, but after choosing "Android+Goodle API's" I can see another Message: <img255.imageshack.us/img255/6353/przechwytywaniera.png >
  • David
    David over 11 years
    I think this is a bug, because google play is never installed on the emulator, and google play usually updated the google play services apk, you may copy the google play services apk from a device and install it on the emulator
  • sabadow
    sabadow over 11 years
    Some users created an emulator that supports it! stackoverflow.com/questions/13691943/…
  • sabadow
    sabadow over 11 years
    Some users created an emulator that supports it! stackoverflow.com/questions/13691943/…
  • brabertaser19
    brabertaser19 about 11 years
    where did you get apk files?
  • user2101068
    user2101068 about 11 years
    Sorry....It's been a while so I don't recall where I got the files but I'm pretty sure I just Googled them and found them on line.
  • Joel Malone
    Joel Malone almost 11 years
    Regarding not being able to two-finger-tap to zoom out, you can use a tap-tap-slide up or down to zoom in and out, which works with one finger (i.e. mouse).
  • Dan Devine
    Dan Devine almost 11 years
    Yes, it works... but does require installation of separate APK's into emulator image.
  • Dan Devine
    Dan Devine almost 11 years
    I discovered that selecting an emulator image which includes the Google API's does not work. When attempting to install the above apk's, adb reported "Failed: Already installed". When running the application, the map just returned gray. When selecting an emulator WITHOUT Google APIs, and manually installing the APKs, everything worked correctly.
  • Nuntipat Narkthong
    Nuntipat Narkthong almost 11 years
    Yes, you should select an image without the Google API. As I've already indicated in the second paragraph "Other configuration that target pure Android not the google one should work to.".
  • Muhammad Babar
    Muhammad Babar over 10 years
    @PalmRobotZ is it possible to show GoogleAndroidMapsV2 on Android 2.2 Emulator?
  • prap19
    prap19 over 10 years
    If I do not use Google Api for emulator image then while installing my app I get this error "INSTALL_FAILED_MISSING_SHARED_LIBRARY". What to do in such a case?
  • Rishabh Srivastava
    Rishabh Srivastava over 10 years
    Genymotion has stopped the google play services now.
  • JJD
    JJD over 10 years
    @RishabhSrivastava You have to install GoogleApps yourself. Please read this and this posts.
  • Saqlain
    Saqlain about 10 years
    I am using Android 4.4.2 on Emulator with Hardware Acceleration enabled, just install com.google.android.gms-2.apk, com.google.android.apps.maps-1.apk and Phonesky.apk, using adb and with this i got google map working on Emulator...Btw these apk's are downloadable from above answer...
  • Hsu Wei Cheng
    Hsu Wei Cheng almost 9 years
    It need extra works to work on android emulator. It's POSSIBLE!
  • obayhan
    obayhan almost 9 years
    Yes you can do with some efford
  • C0D3
    C0D3 almost 8 years
    You need to create an Google services API key for your app here: console.developers.google.com/apis then add this key to google_maps_api.xml file that is in your project
  • arekolek
    arekolek about 7 years
    This is true. In addition, API 19 also worked for me.
  • Shahzain ali
    Shahzain ali about 7 years
    Failure [INSTALL_FAILED_UPDATE_INCOMPATIBLE]