Running Google Maps v2 on the Android emulator
G

11

46

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)?

Germanic answered 26/12, 2012 at 11:47 Comment(3)
How to set up a fast emulator for Android on Linux?Ronald
see here for a blazing fast virtualization solution : https://mcmap.net/q/40679/-alternatives-to-the-android-avd-emulator-closedBred
possible duplicate of This app won't run unless you update Google Play Services. (via Bazaar)Waldack
T
29

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.

Tartuffe answered 27/12, 2012 at 1:12 Comment(5)
Some users created an emulator that supports it! #13692443Lillianalillie
Yes, it works... but does require installation of separate APK's into emulator image.Uncontrollable
It need extra works to work on android emulator. It's POSSIBLE!Publius
Yes you can do with some effordHippie
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 projectFecit
S
25

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.

Seclusion answered 11/6, 2013 at 4:7 Comment(5)
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.Uncontrollable
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.".Seclusion
@PalmRobotZ is it possible to show GoogleAndroidMapsV2 on Android 2.2 Emulator?Caster
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?Hippel
Failure [INSTALL_FAILED_UPDATE_INCOMPATIBLE]Cresa
R
14

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.
Raiment answered 28/1, 2013 at 12:48 Comment(1)
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...Pretoria
C
12

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

Comparative answered 11/1, 2013 at 4:55 Comment(0)
R
4

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.

Ronald answered 13/11, 2013 at 9:46 Comment(2)
Genymotion has stopped the google play services now.Polymeric
@RishabhSrivastava You have to install GoogleApps yourself. Please read this and this posts.Ronald
T
2

I am able to have my emulator to run my app with Google Map V.2 (with Google Play Service V.4). I followed steps that others suggested with some failures, however I learned from it and somehow make it work. This is how:

  1. First of all: You must have coded your map app. correctly with all the appropriate permissions setup in your metafile XML, and have Google Play Services APK part of your app. To verify this is true, you must run your app on REAL device and know it works with its map there. Then you can proceed to process your emulator as shown below.

  2. Create a new emulator, or use your existing emulator with specs:

    • Target Name = Android 4.1.2
    • API Level = 16
    • CPU = Any. However, I found ARM is much faster/responsive than x86
    • Have enough RAM memory and space MB
  3. Run you emulator (your target emulator must be running!)

  4. Download the following APKs (available via dropbox per 4/2/2013) to your local directory (scan for virus!):

  5. Install these two APK into your running (target) emulator with ADB command:

    DOS/Console Prompt> adb -e install [path-to-APK-file]

    NOTE: Possibly, you have had these APKs installed in your emulator during this trial-error, and need to re-install for some reason. You must uninstall them first by: adb -e uninstall (com.google.android.gms or com.android.vending)

  6. Here, it is where things could get tricky. You think you were done, but when you open your app with Map again, but all you get is an error saying something in the form of: "Google Play services out of date. Requires 2012100 but found 2010110", and may see a button to "Update" Google Play. If this is the case, do NOT attempt to click the update button since it won't do anything. I got this error too, and I resolved it by both of these additional steps:

    • Clean-rebuild-reinstall my app into the emulator
    • Shutdown my emulator and re-start it.
  7. That's it, it works now nicely.

Tim answered 2/4, 2013 at 18:59 Comment(0)
T
2

Google has updated the Virtual Device targeting API 23. It now comes with Google Play Services 9.0.80. So if you are using Google Maps API V 2.0 (I'm using play-services-maps:9.0.0 and play-services-location.9.0.0) no workaround necessary. It just works!

Tindal answered 14/6, 2016 at 16:39 Comment(1)
This is true. In addition, API 19 also worked for me.Mahmud
L
1

You need to try on an emulator with the Google API's version. Each platform has two versions, Android and Android+Google APIs. Ensure that when you create the AVD, you select the Google APIs version on target field.

And the page Ensure Devices Have the Google Play services APK can be also helpful.

Lillianalillie answered 26/12, 2012 at 12:15 Comment(3)
Thank you, but after choosing "Android+Goodle API's" I can see another Message: <img255.imageshack.us/img255/6353/przechwytywaniera.png >Germanic
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 emulatorOgive
Some users created an emulator that supports it! #13692443Lillianalillie
C
1

I have successfully run our app, which requires Google Maps API 2, on an AndroVM virtual machine.

AndroVM does not come with Google Maps or Google Play installed, but provides a modified copy of the Cyanogen Gapps archive, which is a set of the proprietary Google apps installed on most Android devices.

The instructions, copied from the AndroVM FAQ:

How can I install Google Apps (including the Market/Play app) ?

  • Download Google Apps : gapps-jb-20121011-androvm.tgz [basically the /system directory from the Cyanogen gapps archive without the GoogleTTS app which crashes on AndroVM]
  • Untar the gapps…tgz file on your host – you’ll have a system directory created
  • Get the management IP address of your AndroVM (“AndroVM Configuration” tool) and do “adb connect x.y.z.t”
  • do “adb root”
  • reconnect with “adn connect x.y.z.t”
  • do “adb remount”
  • do “adb push system/ /system/”

Your VM will reboot and you should have google apps including Market/Play.

You won’t have some Google Apps, like Maps, but they can be downloaded from the Market/Play.

So follow those instructions, then just install Google Maps using Google Play!

Some great side effects of using a VM rather than the emulator:

  • Vastly superior general performance
  • OpenGL acceleration
  • Google Play support

The only bump in the road so far has been lack of multi-touch gestures, which is a bummer for a mapping app! I plan to work around this with a hidden UI mechanism, so not such a huge problem.

Castellan answered 18/5, 2013 at 3:2 Comment(1)
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).Castellan
G
0

I tried the steps above (by paniniluncher) but received the following message:

Google Play services out of date. Requires 3025100 but found 2012110

I received this message because I required different versions of the files noted above. To resolve the issue I first uninstalled the files referenced above, downloaded the versions that I needed (as referenced in the following StackOverflow posting:

Google Play services out of date. Requires 3025100 but found 2012110

and then installed these files using the `adb -e install [path-to-APK-file] and then restarted the emulator and it worked perfectly!

Grimy answered 8/4, 2013 at 4:16 Comment(2)
where did you get apk files?Poussette
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.Grimy
F
0

I have already replied to this question in an answer to Stack Overflow question Trouble using Google sign-in button in emulator. It only works for Android 4.2.2, but lets you use the "Intel Atom (x86)" in AVD.

I think that it is easy to make it work for other versions of Android. Just find the correct files.

Fleury answered 30/1, 2014 at 18:20 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.