With the recent release of Android 5.x, I decided that it was time to release an update on how to install the Google Play Store on the Android Emulator. This document outlines the steps required using the latest version of the Android SDK (Revision 24.0.2) and is focused on Android 5.0.1 (API 21).
Install the Android 5.0.1 Image
With that, let’s begin by launching the SDK manager. We’ll first need to ensure that Android 5.0.1 (API 21) is installed.
[pyoor@localhost]$ cd ~/android-sdk/tools/ [pyoor@localhost tools]$ ./android sdk
If it’s not, check the top level element, “Android 5.0.1 (API 21),” and click “Install 15 Packages.” Then, when prompted, accept the license agreement and continue.
Create the AVD
Once installed, close the SDK manager and launch the AVD manager.
[pyoor@localhost tools]$ ./android avd
Here we’ll need to create a new AVD which utilizes the Android 5.0.1 platform and has snapshots enabled so that any changes we make are persistent. Also, due to the increased size of the 5.0.1 image, we’ll need to allocate at least 2048MB of RAM for our AVD.
Download the GAPPS Package
Next we need to pull down the appropriate Google Apps package that matches our Android AVD version. In this case we’ll be using the gapps-lp-20141109-signed.zip package. You can download that file from BasketBuild here.
[pyoor@localhost]$ md5sum gapps-lp-20141109-signed.zip 367ce76d6b7772c92810720b8b0c931e gapps-lp-20141109-signed.zip
In order to install Google Play, we’ll need to push the following 4 APKs to our AVD (located in ./system/priv-app/):
- GmsCore.apk
- GoogleServicesFramework.apk
- GoogleLoginService.apk
- Phonesky.apk
[pyoor@localhost]$ unzip -j gapps-lp-20141109-signed.zip \ system/priv-app/GoogleServicesFramework/GoogleServicesFramework.apk \ system/priv-app/GoogleLoginService/GoogleLoginService.apk \ system/priv-app/Phonesky/Phonesky.apk \ system/priv-app/GmsCore/GmsCore.apk -d ./
Push APKs to the Emulator
With our APKs extracted, let’s launch our AVD using the following command.
[pyoor@localhost tools]$ ./emulator @Flinkd -no-boot-anim
This may take several minutes the first time as the AVD is created. Once started, we need to remount the AVDs system partition as read/write so that we can push our packages onto the device.
[pyoor@localhost]$ cd ~/android-sdk/platform-tools/ [pyoor@localhost platform-tools]$ ./adb remount
Next, push the APKs to our AVD:
[pyoor@localhost platform-tools]$ ./adb push GmsCore.apk /system/priv-app/ [pyoor@localhost platform-tools]$ ./adb push GoogleServicesFramework.apk /system/priv-app/ [pyoor@localhost platform-tools]$ ./adb push GoogleLoginService.apk /system/priv-app/ [pyoor@localhost platform-tools]$ ./adb push Phonesky.apk /system/priv-app/
Profit!
And finally, reboot the emualator using the following commands:
[pyoor@localhost platform-tools]$ ./adb shell stop && ./adb shell start
Once the emulator restarts, we should see the Google Play package appear within the menu launcher. After associating a Google account with this AVD we now have a fully working version of Google Play running under our emulator:
February 28th, 2015 on 7:01 am
in the Download The GAPPS Packages section. You have installed the same GoogleServicesFramework.apk twice, I think one of them should be the Gmscore.apk
March 2nd, 2015 on 9:10 am
Works like a charm, but it seems there is an error in the instructions for pushing apks , you push GoogleServicesFramework.apk twice and don’t push GmsCore.apk
March 2nd, 2015 on 7:20 pm
Good catch! Thanks!
March 3rd, 2015 on 11:14 pm
Hi,
I have installed with no problem. But there are problems with login using google account.
March 3rd, 2015 on 11:16 pm
Did you reboot the emulator after installing the apks? If so and it still doesn’t work, check logcat.
March 18th, 2015 on 7:37 am
Where the instructions need to be executed?
android sdk terminal?
March 18th, 2015 on 3:18 pm
Yes. The sub-directories for each command are listed above.
May 15th, 2015 on 6:49 pm
No errors while pushing the apks , but after reboot i cant see Play store app. but i can see google maps and im able login in settings using google account
May 15th, 2015 on 7:06 pm
Do you see any error messages using “adb logcat”?
May 17th, 2015 on 11:50 am
Unfortunately, Not understandable for starters?
Some questions :
Where do I put a folder gapps-lp-20141109-signed After extracting?
I do not know (pyoor@localhost)
May 28th, 2015 on 2:10 pm
You can unpack it to any directory. When you push to the device, you will need to specifically point to the required apks.
May 23rd, 2015 on 11:10 pm
Thanks for the guide!
I got another problem now, which is that i cannot access google play store. I added an existing google account but it does all it says is “Authenticaton is required. You need to sign into your google account” when i try to go into the play store now. And it seems that the sync function does not work.
Another problem i have is that everything i restart the emulator, Play store wipes even thought i have “Wipe data” unchecked.
Im running the emulator on Nexus 5 API 21, Google API as well so i dont know why this is happening.
Please help!
Thanks!
May 28th, 2015 on 2:10 pm
Have you enabled snapshots for your VM?
June 14th, 2015 on 1:05 pm
I get the same “Authentication Error”. Logcat shows -> Google Play services signature invalid.
June 30th, 2015 on 4:25 pm
Looks like you may be using the Google API image. That creates a disconnect between GoogleFrameworkServices and Google Play. Try again using the standard API.
July 24th, 2015 on 12:57 pm
Very slow when using Snapshots. I use HostGPU and run a script to setup PlayStore everytime the emulator launches.
Create a folder in ~/Android/Sdk/platform-tools/ and extract the 4 apks there
Create the script:
#!/bin/bash
cd ~/Android/Sdk/platform-tools/
./adb remount
./adb push Phonesky /system/priv-app/
./adb shell stop && ./adb shell start
Make script executable:
sudo chmod 755 setup_play_store.sh
Once emulator started with no boot animation, run the script:
./setup_play_store.sh
Good to go!
December 11th, 2015 on 7:50 pm
Hey folks, for some reason when I turn on Google Maps it’s a black screen …. is there an OpenGL problem with that? (Running on a Mac OS tried different emulators)
also so many apps keeping saying from the Google Play Store “Incompatible” … I’ve tried Nexus S, Nexus 7… same stuff. Do you folks know how to fix that? Which type I should use to use popular apps like Instagram and Skype and etc.
December 11th, 2015 on 8:47 pm
I was wondering maybe it has something to do with x86 vs ARM CPU Arch???
certain games and Apps like Slack work but apps like Twitter, FB, FB Messenger, Instagram, Snapchat, Angry Birds and Uber don’t…. say their incompatible… I thought Google Play Store should filter them out and not show but it just says their incompatible.
January 24th, 2016 on 4:50 pm
Very good tutorial, thanks.
I’ve followed all the steps and it is working as expected, but, after completing the google account log in, when I try to execute shell commands on the device via ADB, the shell freezes\hangs.
for example “adb shell date” is stuck (device is recognized and its state is “device” in “adb devices”).
if I execute “adb kill-server” and then “adb devices” the emulator is offline.
does anyone know how to get passed it? I must keep executing shell commands.
thanks,
Gil.
February 29th, 2016 on 2:15 am
Can I use any GApps?
Like the ones in this link: http://opengapps.org/?api=6.0&variant=nano
I understand that I need to choose the right API version, but that’s it aye??
March 18th, 2016 on 11:58 am
Thanks for tutorial, now i can use Google Service for my app in simulator.
May 5th, 2016 on 4:34 am
Hi there, I was wondering if you’d had any luck doing the above with marshmallow (API 23)? I’ve tried replicating your steps, but every time I try and ‘push’ the apks onto the emulator, I get something along the lines of:
failed to copy ‘PrebuiltGmsCore.apk’ to ‘/system/priv-app/PrebuiltGmsCore.apk’: Read-only file system
I have posted a stackoverflow here:
http://stackoverflow.com/questions/37042366/how-to-install-android-wear-app-onto-android-marshmallow-avd-emulator
Thanks!
May 6th, 2016 on 9:36 pm
Great tutorial, I’m just missing one piece of deal-breaking info: Where is the “gapps-lp-20141109-signed.zip” file coming from? I can see the download, but what if I want to do this for Marshmallow, or N preview; or I’m using ARM and not x86?
> we need to pull down the appropriate Google Apps package that matches our Android AVD version
I think “pull down” and “appropriate” need to be expanded on a little more for this post to be useful in the future.
May 18th, 2016 on 6:01 pm
Hi guys
Trying to do the same on windows7 and failing on step adb push GmsCore.apk /system/priv-app/
My flow little bit differs from yours
Instead of unzip -j gapps-lp-20141109-signed.zip – I created temp folder ‘D:\temp’
Then I perfrom :
adb push “d:\temp\system\priv-app\GmsCore\GmsCore.apk” “/system/priv-app/”
And got an error :failed to copy ‘d:\temp\system\priv-app\GmsCore\GmsCore.apk’ to ‘/system/priv-app//GmsCore.apk’: Read-only file system
adb remount
then
adb push ‘D:\temp\
Could someone help?
June 14th, 2016 on 9:09 am
Cannot run adb remount. The message is “Read only file system”
June 19th, 2016 on 8:38 am
i linked android sdk with eclipse…..can i launch the avd through the teminal on linux
June 19th, 2016 on 3:17 pm
error:more than one device/emulator…. when trying ./adb remount
September 1st, 2016 on 10:16 am
Doesn’t work:
failed to copy ‘priv-app/GoogleServicesFramework/GoogleServicesFramework.apk’ to ‘/system/priv-app/GoogleServicesFramework/GoogleServicesFramework.apk’: Read-only file system