Google Play on Android 4.0 emulator

203,528

Solution 1

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*

Solution 2

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).

Solution 3

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.

Solution 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

Solution 5

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

Share:
203,528

Related videos on Youtube

Sarath
Author by

Sarath

Updated on July 08, 2020

Comments

  • Sarath
    Sarath almost 4 years

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

    • amb
      amb about 12 years
      Note: comments have mixed results, so your mileage may vary
    • reox
      reox about 12 years
      but its the same with other emulator versions, and it worked there so why it shoudnt work in 4.x? :)
  • Catalin Morosan
    Catalin Morosan almost 12 years
    Note: Vending.apk is called Phonesky.apk in latest releases
  • Salman von Abbas
    Salman von Abbas over 11 years
    Server Offline. Please hang tight while we get this resolved. :'(
  • phihag
    phihag over 11 years
    When installing with this method, I can register and login, but get an error Error retrieving information from server [RH-01] afterwards.
  • Mechanical snail
    Mechanical snail about 11 years
    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.
  • mike
    mike about 11 years
    the -partition-size param is important, without it i got OutOfMemory exception while pushing the apks
  • yoel halb
    yoel halb about 11 years
    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
  • quinestor
    quinestor almost 11 years
    do you mean that Genymotion's vms have a google play implementation in them?
  • Androiderson
    Androiderson almost 11 years
    @craig65535 if you are using the map api, some people are having issues with that, that's way I recommended Genymotion.
  • Ross Hambrick
    Ross Hambrick almost 11 years
    Holy mother! Genymotion is suweet!
  • gdw2
    gdw2 almost 11 years
    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
    gdw2 almost 11 years
    @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.
  • Loudenvier
    Loudenvier over 10 years
    +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!
  • chris-l
    chris-l over 10 years
    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.
  • Abhishek Susarla
    Abhishek Susarla over 10 years
    +1s are way too less for the aha- moment happiness.. StackOverflow should have a kiss-cos-ur-so-happy-button :)
  • Johnny_D
    Johnny_D over 10 years
    Does anyone have problem with connecting to Google services after installing Play this way on emulator?
  • Johnny_D
    Johnny_D over 10 years
    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
    Johnny_D over 10 years
    Should I follow this instructions in emulator image with Google Play API services?
  • Johnny_D
    Johnny_D over 10 years
    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.
  • Androiderson
    Androiderson over 10 years
    @Johnny_D Genymotion works just like a real device. Just run it and it will be automatically detected by any IDE.
  • Adam Johns
    Adam Johns over 10 years
    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. Here is a direct link
  • bonh
    bonh almost 10 years
    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.
  • Steve
    Steve over 9 years
    Where I need to place the .apk file.In my project or adt bundle platform tools?
  • insomniac
    insomniac over 9 years
    copy it to platform-tools unless you have set your PATH environmental variable
  • martyglaubitz
    martyglaubitz over 9 years
    genymotion does not provide VMs with API level lower than 16
  • Nate
    Nate over 9 years
    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.
  • HelpMatters
    HelpMatters over 9 years
    The link to download Google Play services are not working anymore. I think the root link goo.im/gapps itself is removed.
  • Piotr Kula
    Piotr Kula about 9 years
    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
    Piotr Kula about 9 years
    Installing Play store for Lollipop stackoverflow.com/questions/27045599/…
  • Nitin Bansal
    Nitin Bansal about 9 years
    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
  • Gopal Singh Sirvi
    Gopal Singh Sirvi about 9 years
    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?
  • Mr. Pundir
    Mr. Pundir almost 9 years
  • Olcay Ertaş
    Olcay Ertaş almost 9 years
    Any yaffey alternative for Mac?
  • Vihaan Verma
    Vihaan Verma almost 9 years
    getting rm: /system/app/SdkSetup: is a directory error on api 22
  • Xiao
    Xiao over 8 years
    @OlcayErtaş Mac Yaffey: github.com/danielkutik/yaffey. Builds a Yaffey.app, works perfectly on my Yosemite.
  • Xiao
    Xiao over 8 years
    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.
  • Sean Champ
    Sean Champ over 8 years
    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
    Sean Champ over 8 years
    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.
  • Androiderson
    Androiderson over 8 years
    @SeanChamp good point but final tests should always be on a real device
  • Sean Champ
    Sean Champ over 8 years
    @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
  • Anonymous
    Anonymous over 8 years
    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
  • osdamv
    osdamv over 8 years
    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]
  • IgorGanapolsky
    IgorGanapolsky about 8 years
    Nope, the zip with GAPPS is too big.
  • IgorGanapolsky
    IgorGanapolsky about 8 years
    System doesn't have enough space to install GAPPS.
  • Sanyam Jain
    Sanyam Jain about 8 years
    Permission Denied.
  • Joshua Son
    Joshua Son about 8 years
    @SanyamJain Did you solve that problem? I get the same message, mount: Permission denied
  • Sanyam Jain
    Sanyam Jain about 8 years
    @JoshuaSon: No I couldn't. And after reading from various sources I came to conclusion that It might not be worth the effort, as the emulator keeps on crashing or this strategy doesn't work for Upcoming versions of Android. Correct me if I am wrong :)
  • osrl
    osrl over 7 years
    I'm gettin system not in proc/mounts. Trying on a 7.1 emulator