Installing Google Play Services (GAPPS) on Visual Studio Android Emulators

2015-10-28 12_39_14-XDEUpdate: I have updated this post for 2017 here, I recommend that you read that instead.

I am developing a Xamarin application that displays maps. On Android, the map control requires that Google Play Services is installed, but most emulator images do include them. I mainly develop on Windows, so I have been using the great Visual Studio Emulator for Android. I prefer it because it is fast and uses Hyper-V. Other emulators like Xamarin’s or GenyMotion use VirtualBox under the covers which doesn’t work if you have Hyper-V enabled and I have had networking problems when it is installed and my laptop resumes from sleep.

Xamarin has a great article on how to install Google Play Services on their emulators, but it doesn’t work with the Visual Studio Emulator. I then found the solution on StackOverflow written Vijay Sargunam. His solution worked perfectly, but was missing a few steps, so the following are my modifications to his work.

  1. Download the correct GAPPS for the Android version from http://www.teamandroid.com/gapps/
  2. Use the Additional Tools (small >> icon) for the emulator and go to the SD Card tab.
  3. Select a folder on your computer to sync with the virtual SD card.
  4. Pull from SD card, which will create a folder structure on the selected folder.
  5. Now copy the Gapps fill to the ‘Download’ folder.
  6. Push to SD card. This will take a little while, and copy the zip file to your emulator.
  7. Run a commmand prompt, and go to sdk\platform-tools in your Android SDK location and run adb devices.
  8. If you see the your emulator in the list, then skip to step 10.
  9. If you do not see emulator, run the following: adb connect <emulator ip>:5555 You can find the emulator ip, from within the emulator, go to Settings -> About Phone -> Status and IP section.
  10. Next run, adb shell. This will give you a prompt to the android emulator.
  11. Confirm the gapps file is there: ls /sdcard/Download
  12. Now run, install_zip.sh /sdcard/Download/<flashablezip>.zip This should begin the flashing process.
  13. Once the flashing is complete, restart the emulator.
  14. Once you restart, you may see errors with apps like Google+ trying to start up, ignore them for now.
  15. Sign into your Google account and upgrade all apps from Google Play.
  16. When you run your application that requires Google Play services, you may be prompted to upgrade

Voilá, maps running in the emulator!

  • It seems happy enough to install it and the Google Play app is there, it just won’t run. I’ll drop the teamandroid.com team a message. Thanks again for your help and blog post.

  • Rob Prouse

    Yes, it sounds like the GAPPS package you have doesn’t match the emulator you are installing it in.

  • I’d tried the 5″ Marshmallow XXHDPI phone profile and although the GAPPS package installed fine after restarting the emulator the Google Play app wouldn’t launch.

    I tried the 5″ KitKat XXHDPI profile (different GAPPS package) and that worked.

    I’ve just tried the 5.7″ profile instead and that doesn’t work either.
    Perhaps there’s an issue with the Marshmallow GAPPS package.

  • Rob Prouse

    I haven’t tried it that way. Did you open the play store, sign in and update?

  • I successfully installed gapps-600-base-20151016-1-signed.zip, simply by dragging it on to the running Visual Studio emulator, after a restart the Play Store icon is present but it will not launch and when debugging my app I’m still getting the error saying Google Play services are not installed. Any ideas please?

  • Peng Cheng

    What do you mean by ‘use the emulators that include the Google API’s’? There is no such option in AVD Manager.

  • Laila Sukhni

    Thank you very much

  • Rob Prouse

    Laila, if you are using Xamarin.Forms, you can use the same C# code for each platform and it will create platform specific maps on each platform. See https://developer.xamarin.com/guides/xamarin-forms/user-interface/map/

    If you are not using Xamarin.Forms then you are already creating UI for each platform. You can still abstract a lot of the business logic away down to the common layer, but it is a bit more work. You will likely want to look at something like MVVM Cross for that.

  • Laila Sukhni

    Thanks rob prouse,l am new with programing with xamarin and I want to build gis application that work in android and windows phone do I have to write diffrent c# code for each type of mobile when I use xamarin?

  • Rob Prouse

    I am sorry Laila, Windows Mobile has such a small market share that I don’t do much development on that platform. I don’t think Google Play services is available. As far as I know, for maps, you need to use the Bing map control on Windows Mobile.

  • Laila Sukhni

    i have a question please, xamarin support google play services in windows mobile also???

  • Rob Prouse

    That is a very good point for the Google supplied emulators. That said, I should take a look at the install_zip.sh script that Microsoft includes in their emulators. It is probably just and unzip and install. I could reproduce those steps here for people using other emulators.

  • Yeah, that install_zip.sh script is not there. But, when you’re using that approach, you can use the emulators that include the Google API’s. Just check in AVD Manager. No need to install it manually!

  • Thanos

    I’m trying to install Google Services on stock Android Emulator,
    running an AVD of Android 6.0 (Marshmallow), without using Visual Studio..
    There is no install_zip.sh there. I though the solution would work in stock Emulator too..

  • install_zip.sh is on the emulator, I believe in the root directory. You should be able to run it from the adb command prompt when you opened in step 10.

  • Thanos

    Where is the install_zip.sh ? I downloaded the last version of Gapps for API 23 from the link you provided:
    http://www.teamandroid.com/gapps/
    and doesn’t include such a script..

  • Managed to install e.g. Google Chrome browser from Google Play on the 5.1.1 emulator mentioned previously, but Chrome just crashes in it. Also Arm vs. Intel processor issue or something else? No idea…

  • I was getting an error when installing OpenGapps package. The TeamAndroid.com package actually installed in 5.1.1, but they seem to have packages for ARM processor only, not for Intel, which is what emulators use. So different apps crash, but disabled the crashing AOSP keyboard, upgraded something else and for now seems to be fine. Will see how it goes afterwards, thank you!

  • I am running GAPPS in the latest release of the Visual Studio Emulator for Android against a 5.1.1 image right now. I haven’t tried Marshmallow yet though.

  • Does not work for Android v5 or v6 Visual Studio emulators… Nothing works at all, did you have any success with new versions of Android emulators?