185

How can I install the Google Play .apk onto my Android 4.0 emulator?

Mateen Ulhaq
  • 24,552
  • 19
  • 101
  • 135
Sarath
  • 1,889
  • 2
  • 12
  • 8

8 Answers8

259

Download Google apps (GoogleLoginService.apk , GoogleServicesFramework.apk , Phonesky.apk)
from here.

Start your emulator:

emulator -avd VM_NAME_HERE -partition-size 500 -no-audio -no-boot-anim

Then use the following commands:

# Remount in rw mode.
# NOTE: more recent system.img files are ext4, not yaffs2
adb shell mount -o remount,rw -t yaffs2 /dev/block/mtdblock0 /system

# Allow writing to app directory on system partition
adb shell chmod 777 /system/app

# Install following apk
adb push GoogleLoginService.apk /system/app/.
adb push GoogleServicesFramework.apk /system/app/.
adb push Phonesky.apk /system/app/. # Vending.apk in older versions
adb shell rm /system/app/SdkSetup*
Chan Tzish
  • 1,108
  • 9
  • 7
Mohan raja
  • 2,607
  • 2
  • 12
  • 2
  • 21
    Note: Vending.apk is called Phonesky.apk in latest releases – Catalin Morosan Sep 11 '12 at 08:44
  • 1
    Server Offline. Please hang tight while we get this resolved. :'( – Samuel Katz Feb 14 '13 at 08:06
  • 1
    When installing with this method, I can register and login, but get an error `Error retrieving information from server [RH-01]` afterwards. – phihag Feb 15 '13 at 04:32
  • 16
    the ***-partition-size*** param is important, without it i got OutOfMemory exception while pushing the apks – mike May 20 '13 at 11:39
  • When installing with this method it worked by me only with the default data network, however it had a error logging in when I was on a different APN, so make sure you do not use any proxy for the Access Point – yoel halb May 20 '13 at 18:51
  • 12
    I think this answer should be the accepted answer. After all, this IS an actual answer, the current accepted answer (11/11/2013) is only a "breaking the eula is like a bad thing, m'kay?" type of comment. – chris-l Nov 11 '13 at 22:16
  • 3
    Does anyone have problem with connecting to Google services after installing Play this way on emulator? – Johnny_D Feb 05 '14 at 19:22
  • Should I follow this instructions in emulator image with Google Play API services? – Johnny_D Feb 06 '14 at 08:22
  • If you also want to be able to use a 4.0.3 emulator for GCM testing, you will also need to add the GmsCore.apk from the 4.3 package [here](http://goo.im/gapps). Here is a [direct link](http://goo.im/gapps/gapps-jb-20130813-signed.zip) – Adam Johns Apr 04 '14 at 20:31
  • 4
    Am I the only one not able to get this to work? On both 4.4 and 5.0 emulators, adding the APKs does not show the Play Store icon, and `adb reboot` just hangs. – Nate Feb 09 '15 at 10:27
  • The link to download Google Play services are not working anymore. I think the root link http://goo.im/gapps itself is removed. – HelpMatters Mar 31 '15 at 21:08
  • I'm unable to see play store icon on emulator after Successfully following all steps......is there any caveat to this method? Im running android 5.1 emulator image – Nitin Bansal Apr 28 '15 at 08:19
  • all was working fine but after closing the emulator and starting it again with eclipse is removing the playstore is there any solution to this problem? – Gopal Singh Sirvi Jun 17 '15 at 06:32
  • 2
    Links Are:- https://electrocoder.googlecode.com/files/GoogleLoginService.apk , https://androidmarketu.googlecode.com/files/GoogleServicesFramework.apk , https://drive.google.com/a/sakshay.in/file/d/0B2ykO0YZXDgQMmNfbThJVzJHb2s – Mr. Pundir Jul 09 '15 at 06:48
  • getting rm: /system/app/SdkSetup: is a directory error on api 22 – Vihaan Verma Sep 23 '15 at 11:18
  • adb push seems to have problem `failed to copy 'GoogleLoginService.apk' to 'C:/Program Files/Git/system/app/': No such file or directory` when using window gitbash. Solved by using window cmd – Anonymous Feb 25 '16 at 02:00
  • 2
    looks like this methos only works in android 4.x, in android 5 it fails for some kind of certifcated Failure [INSTALL_PARSE_FAILED_NO_CERTIFICATES] – osdamv Mar 21 '16 at 07:52
  • I'm gettin `system not in proc/mounts`. Trying on a 7.1 emulator – osrl Nov 29 '16 at 20:15
85

For future visitors.

As of now Android 4.2.2 platform includes Google Play services. Just use an emulator running Jelly Bean. Details can be found here:

Setup Google Play Services SDK

EDIT:

Another option is to use Genymotion (runs way faster)

EDIT 2:

As @gdw2 commented: "setting up the Google Play Services SDK does not install a working Google Play app -- it just enables certain services provided by the SDK"

After version 2.0 Genymotion does not come with Play Services by default, but it can be easily installed manually. Just download the right version from here and drag and drop into the virtual device (emulador).

Androiderson
  • 16,865
  • 6
  • 62
  • 72
  • do you mean that Genymotion's vms have a google play implementation in them? – quinestor Jul 12 '13 at 12:49
  • @craig65535 if you are using the map api, some people are having issues with that, that's way I recommended Genymotion. – Androiderson Jul 20 '13 at 14:41
  • 6
    Holy mother! Genymotion is suweet! – Ross Hambrick Aug 21 '13 at 02:16
  • Genymotion is faster than the emulated ARM image. It is probably the same speed as the HAXM-enabled x86 android image that is available with the Android SDK. – gdw2 Oct 03 '13 at 16:37
  • 6
    @Exception-al I think you should update your answer to clarify that setting up the Google Play Services SDK does not install a working Google Play app -- it just enables certain services provided by the SDK. – gdw2 Oct 03 '13 at 16:49
  • 1
    +1 for suggesting Genymotion!!! I didn't know it existed and now I can't live without it. It plays flawlessly with Android Studio (just add the plugin) and now I can debut my Google Maps V2 apps without resorting to "real" devices! Thanks a million! – Loudenvier Oct 19 '13 at 23:26
  • Genymotion is so cool at perfomance, but still there is no Play app, so I don't have desired opportunity to install custom apps/ – Johnny_D Feb 06 '14 at 07:57
  • Thanks, I've already voted up. But can you please also share if there any tutorial of how to set up Eclipse to work with Genymotion. – Johnny_D Feb 06 '14 at 10:10
  • @Johnny_D Genymotion works just like a real device. Just run it and it will be automatically detected by any IDE. – Androiderson Feb 06 '14 at 10:21
  • Some apps wont install via play store, says device is incompatible. I run a hardware benchmark and it blows the best phone out of the ball game. Not sure what its moaning baout. 4.3 -- But this is Genymotion is really awesome, looks like they did some serious work to the qemu emulator to enable 1GB ram and GPU pass through! – Piotr Kula Apr 23 '15 at 18:43
  • Installing Play store for Lollipop http://stackoverflow.com/questions/27045599/google-play-services-in-genymotion-on-lollipop-android-5-0 – Piotr Kula Apr 23 '15 at 18:54
  • Just an observation: Genymotion uses VirtualBox. VirtualBox uses Intel-specific virtualiation optimizations. It may not be possible to emulate an ARM Android platform with GenyMotion. Perahps such a limitation may not be absolutely a show-stopper, not for all development channels. Genymotion may not be in all ways a 100% replacement for the QEmu-based AVD manager. Peraps, any projects using low-level ARM interfaces (kernel, LibC) may need to be tested on ARM hardware - viz a viz adb - if not to be tested initially in the AVD emulator, on a comp w/ a good fast microcontroller and lots of RAM. – Sean Champ Dec 14 '15 at 16:23
  • 1
    @SeanChamp good point but final tests should always be on a real device – Androiderson Dec 14 '15 at 16:24
  • @Androiderson Totally. Concerning HW, I'm sure any well connected author could write a whole book chapter, even an Open Access book, as to how a Linux kernel fits into an Android platform - concerning any hardware-oriented distinctions that may be found in low-level Linux kernel interfaces for specific microcontrollers, also any specific kernel driver implementations for OEM specific hardware, So far as testing, OEM's may make their own testing channels, of course - as to how a whole Android OS may fit together in any single OEM service bundle, if not also for issue tracking in app production – Sean Champ Dec 14 '15 at 16:41
27

I do this in a more permanent way - instead of installing the APKs each time with adb, permanently add them to the system image that the emulator uses. You will need Yaffey on Windows, or a similar utility on other systems, to modify YAFFS2 images. Copy GoogleLoginService.apk, GoogleServicesFramework.apk, and Phonesky.apk (or Vending.apk in older versions of Android) to the /system/app folder of the system.img file of the emulator. Afterwards I can start the emulator normally, without messing with adb, and Play Store is always there.

Obtaining the Google Play app from your device

Downloading Google Apps from some Internet site may not be quite legal, but if you have a phone or tablet with a corresponding Android version, just pull them out of your device:

adb -d root
adb -d pull /system/app/GoogleLoginService.apk
adb -d pull /system/app/GoogleServicesFramework.apk
adb -d pull /system/app/Phonesky.apk

You must have root-level access (run adb root) to the device in order to pull these files from it.

Adding it to the image

Now start yaffey on Windows or a similar utility on Linux or Mac, and open system.img for the emulator image you want to modify. I modify most often the one in [...]\android-sdk\system-images\android-17\x86.

Rename the original system.img to system-original.img. Under yaffey, copy the APK files you pulled from your device to /app folder. Save your modified image as system.img in the original folder. Then start your emulator (in my case it would be Android 4.2 emulator with Intel Atom processor running under Intel HAX, super-fast on Windows machines) and you'll have Play Store there. I did not find it necessary to delete SdkSetup.apk and SdkSetup.odex - the Play Store and other services still work fine for me with these files present.

When finished with your testing, to alleviate your conscience guilty of temporarily pirating the Google Apps from your device, you may delete the modified system.img and restore the original from system-original.img.

gregko
  • 5,642
  • 9
  • 49
  • 76
  • 5
    There doesn't seem to be a working YAFF2 editor for Linux—but fortunately, it turns out that with a one-line change, Yaffey itself compiles and runs on Linux. [Posted the steps I used on this Ask Ubuntu question.](http://askubuntu.com/questions/234258/how-to-mount-a-yaffs2-filesystem/281178#281178) – Mechanical snail Apr 14 '13 at 00:29
  • +1s are way too less for the aha- moment happiness.. StackOverflow should have a kiss-cos-ur-so-happy-button :) – Abhishek Susarla Jan 17 '14 at 11:52
  • I was able to pull the three APKs off of aa Android 4.1.2 phone without root, but I'm still working on getting them installed someplace else. – bonh Aug 11 '14 at 01:52
  • Any yaffey alternative for Mac? – Olcay Ertaş Jul 10 '15 at 09:24
  • 1
    @OlcayErtaş Mac Yaffey: https://github.com/danielkutik/yaffey. Builds a Yaffey.app, works perfectly on my Yosemite. – Xiao Nov 03 '15 at 21:56
  • Good approach, wasn't working quite right for me. In the end I got the standard 4.0.4 x86 with working gapps by inserting all of the app, lib, and etc/permission files into the system image. – Xiao Nov 03 '15 at 21:57
4
  1. Download the gapps package from http://goo.im/gapps
  2. extract GoogleLoginService.apk,GoogleServicesFramework.apk and Vending.apk Go to cmd window type adb shell
    1. on the shell type mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
    2. then press Ctrl+c to exit. cd to the directory where apks has been extracted,
    3. type adb push <appname>.apk /system/app
    4. then type adb reboot
insomniac
  • 11,146
  • 6
  • 44
  • 55
3

It is simple for me i downloaded the apk file in my computer and drag that file to emulator it install the google play for me Hope it help some one

Muhammad Asif Javed
  • 533
  • 1
  • 7
  • 19
2

You could download it from a Android 4.0 phone and then mount the system image rw and copy it over.

Didnt tried it before but it should work.

reox
  • 5,036
  • 11
  • 53
  • 98
0

Playstore + Google Play Services In Linux(Ubuntu 14.04)


Download Google apps (GoogleLoginService.apk , GoogleServicesFramework.apk )

from here http://www.securitylearn.net/2013/08/31/google-play-store-on-android-emulator/

and Download ( Phonesky.apk) from here https://basketbuild.com/filedl/devs?dev=dankoman&dl=dankoman/Phonesky.apk

GO TO ANDROID SDK LOCATION>>

cd -Android SDK's tools Location-

TO RUN EMULATOR>>

Android/Sdk/tools$ ./emulator64-x86 -avd Kitkat -partition-size 566 -no-audio -no-boot-anim

SET PERMISSIONS>>

cd Android/Sdk/platform-tools platform-tools$ adb shell mount -o remount,rw -t yaffs2 /dev/block/mtdblock0 /system

platform-tools$ adb shell chmod 777 /system/app

platform-tools$ adb push /home/nazmul/Downloads/GoogleLoginService.apk /system/app/.

PUSH PLAY APKS >>

platform-tools$ adb push /home/nazmul/Downloads/GoogleServicesFramework.apk /system/app/. platform-tools$ adb push /home/nazmul/Downloads/Phonesky.apk /system/app/. platform-tools$ adb shell rm /system/app/SdkSetup*

Nazmul
  • 91
  • 1
  • 1
-1

Have you ever tried Genymotion? I've read about it last week and it is great. They have several Android Images that you run (with their own software). The images are INCREDIBLY fast and they have Google Play installed on them. Check it out if it is the kind of thing that you need.

http://www.genymotion.com/

Oliver Drummond
  • 680
  • 1
  • 6
  • 19
  • genymotion does not provide VMs with API level lower than 16 – martyglaubitz Jan 28 '15 at 15:57
  • As a comment about Genymotion, in advise to the arbitrary reader: Genymotion uses the VirtualBox Virtualization platform. VIrtualBox is designed as to emulate Intel microcontroller platforms. Due to this limitation, It may not be possible to emulate ARM microcontroller platforms with Genymotion. This, of course, may serve to introduce an orthogonal question, as whether, when, and why it may be necessary to beta-test an app using a cross-platform SDK, on every single possible microconotroller or microcontroller emulator. The Intel-virt limitation may not be as much a concern, not in all apps? – Sean Champ Dec 14 '15 at 16:17