Installing Google Play Services on an Android Studio emulator

Installing Google Play Services on an Android Studio emulator

Using Open GApps prebuilt packages

Background

While there?s a lot of posts about using Genymotion emulators, few posts are written about Android Studio emulators. This short article shows the steps how to install Google Play Services on Android Studio emulators. We assume that Android Studio is already installed. The description is for API Level 23, but it may work with other levels. It?s tried on OSX, but it should work on Linux, and possibly work on Windows if you change commands properly.

Step 1

Install a system image.

Image for post

Step 2

Open Android Virtual Device (AVD) Manager.

$ANDROID_HOME/tools/android avd &

Create a virtual device.

Image for post

Step 3

Download a Open GApps zip file from the site.

Image for post

As of writing, the downloaded zip file is: open_gapps-x86_64?6.0-pico-20170304.zip

Extract packages.

unzip open_gapps-x86_64-6.0-pico-20170304.zip ‘Core/*’rm Core/setup*lzip -d Core/*.lzfor f in $(ls Core/*.tar); do tar -x –strip-components 2 -f $fdone

Step 4

Start an emulator.

$ANDROID_HOME/tools/emulator @android6 -writable-system &

Step 5

Install packages.

$ANDROID_HOME/platform-tools/adb remount$ANDROID_HOME/platform-tools/adb push etc /system$ANDROID_HOME/platform-tools/adb push framework /system$ANDROID_HOME/platform-tools/adb push app /system$ANDROID_HOME/platform-tools/adb push priv-app /system

Step 6

Restart.

$ANDROID_HOME/platform-tools/adb shell stop$ANDROID_HOME/platform-tools/adb shell startImage for post

You might see ?Unfortunately, Google Play services has stopped? message.

Step 7

Open Play Store and sign in.

Step 8

Stop the emulator and start it again.

$ANDROID_HOME/tools/emulator @android6 -writable-system &

Then, stop it and start it again normally.

$ANDROID_HOME/tools/emulator @android6 &

Disclaimer

These steps worked for me, but there?s no guarantee that they are correct. Please try them at your own risks. Note also that things might change soon, and this article will be obsoleted in the future.

11

No Responses

Write a response