Installing Google Play Services on an Android Studio emulator

Daishi Kato
2 min readMar 6, 2017

--

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.

Step 2

Open Android Virtual Device (AVD) Manager.

$ANDROID_HOME/tools/android avd &

Create a virtual device.

Step 3

Download a Open GApps zip file from the site.

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/*.lz
for f in $(ls Core/*.tar); do
tar -x --strip-components 2 -f $f
done

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 start

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.

--

--