Wednesday, June 10, 2015

Manually install Google Apps on Hyper-V Android emulator

    One of the "hot" new features of Visual Studio 2015 is the new Android Hyper-V emulator. It is an awesome feature as you have a highly performant Android emulator running on the same virtualization engine as the Windows Phone emulator. 
   It is an x86 virtual machine and similar to other Android Virtual machines like Genymotion, Xamarin Android Player the Google applications and services are not installed by default.
     For the other engines they usually support installing Google applications by drag-drop. You just have to download the Google Apps specific for the version of Android your emulator is running (you can download it from here ) and drop the package on the emulator running. For the moment this feature is not supported in the Hyper-V version (might still coming) but you can do it manually with a simple sequence of instructions. 
    This is what you need to do:

1. Download the GApps packages specific for the Android version your emulator is running
2. Unzip the file
3. Open an adb command prompt (if you have the Xamarin Tools installed in Visual Studio 2015 open the menu Tools->Android->Android Adb Command Prompt) and navigate where you have unzipped your files and go to the system folder from the archive.
4. Execute this set of commands:
  • adb remount
  • adb shell chmod 777 /system
  • adb push . /system

What this commands do is remount the system partition of the emulator to be writable and pushes the contents of the system folder from the unzipped package to the system folder on the emulator. This is the only things that you have to do. Just wait a little bit and you will see that the emultator starts to install everything needed. You might need to soft reset the Hyper-V emulator to make everything work (you should be actually prompted to login with your Google account). Before pushing the System folder content you can also delete the packages that you are not using.

Let me know if you have problems or if i works via email or twitter (disabled the comments on the blog because of all the SPAM I am getting)

P.S. If the links to the google apps package are not working just copy the package name and paste it in a search engine of you choice and you will easily find a mirror for the package.