106

I am completely new to using Android Studio and I am trying to install the Google Play app on the emulator. I have installed the Google Repository and Google Play Services as well as a Google APIs x86 Atom System Image from the SDK manager and I am able to set up Google Play Services for my sample application.

I would now like to install the Google Play application on my emulator. How can this be done ? Any suggestions or a solution itself would be most appreciated. Also, thank you very much for your time.

user1841702
  • 2,683
  • 6
  • 35
  • 53

7 Answers7

140

Starting with Android Studio 3.0 Canary 1, you have now some options of devices that come with the Play Store app built-in (like Nexus 5X and Nexus 5 on image below).

enter image description here

Also, you should use a system-image which targets "Google Play" (instead of Google APIs), as said images come with "Google Play" pre-installed, and you can just like a real device open "Google play" and update it.

Update 2022; but even with above, you cannot use the Emulator to test Google Play Billing:

  • You must install your application on a real device to test Google Play Billing,
  • Or, ask Google for "closed testing" permission.

see How to test In-app Billing on an emulator?

Top-Master
  • 7,611
  • 5
  • 39
  • 71
Mateus Gondim
  • 5,362
  • 6
  • 31
  • 51
94

After a long while of testing, everything seems to be outdated. I can't find necessary APK's like GoogleLoginService.apk, etc.

I got it to work by installing two virtual devices.

  1. My Device (a Samsung Galaxy Tab A with custom skin and sizes)
  2. A device, which had the "Play Store Available" icon in your AVD-Manager on the site where you can create a new profile.

I installed the first device and the second device with the same Android version, and used one profile from Samsung (because my tablet is a Samsung).

After that step, I compared the config.ini file located in:

C:\Users\USER\.android\avd\DEVICE_ID

On Ubuntu/Linux it'll be in

~/.android/avd/DEVICE_ID

Change the following variables to:

PlayStore.enabled = true
image.sysdir.1=system-images\android-27\google_apis_playstore\x86\
tag.display=Google Play
tag.id=google_apis_playstore

Here's an example diff of what fields will be changed:

Screenshot: AVD Device config.ini differeneces

After that you'll probably have to re-download the system image for the device, which you can do from Tools > AVD Manager.

Here's an example screenshot of what that'd look like:

Screenshot: Installing system image in AVD Manager

Once done, restart the device, and Play store will be installed and ready to use.

Sune Rievers
  • 2,676
  • 3
  • 25
  • 29
AsDinFlames
  • 949
  • 5
  • 2
  • 1
    Please be careful with your formatting, and be sure to preview your answer before posting. Your entire answer was indented by four spaces which made it appear as a code block, and made it difficult to read. I've reformatted it for you; please review to make sure everything is correct, but also to evaluate how the formatting was achieved for future posts. – Jeremy Caney Jun 17 '20 at 20:06
  • You may also have to download the system image for the device again if the API version is different or the image doesn't already exist. I had to re-download the system image when i was moving from API 29 on Google Pixel 3a to API 30 on Google Pixel 3 XL. If the system image is missing, you'll get `PANIC: Cannot find AVD system path. Please define ANDROID_SDK_ROOT` when you try to run the emulator. You can download system image from _Tools > AVD Manager_ – Aamnah Aug 02 '20 at 06:57
  • 5
    Working in 2021! Thank you! – lambozsolty May 06 '21 at 14:19
  • 3
    When I touch on download I get this error "All packages are not available for download !, The following packages are not available: - Package id system-images; android-23; google_apis_playstore; x86 " – JP711 Jun 20 '21 at 13:59
  • 1
    The best solution until 2021! – Federico Navarrete Sep 01 '21 at 10:48
  • 1
    Heroic. I have a working emulator for API 30 finally – click_whir Sep 17 '21 at 00:24
  • 1
    The real question is why isn't AVD showing emulator images with Google Play??? – zerox1212 Oct 19 '21 at 20:27
  • you are smart one!! – bebosh Jan 04 '22 at 23:39
  • Pixel C API 31 works fine now after changing ini – Karmalakas Apr 24 '22 at 10:35
  • this solution not working on sdk level 22 in android studio emulator using nexus s – Abdur Rehman Sep 23 '22 at 05:19
  • It looks like it is working only for those versions, which have google play enabled versions in the list, 9 and higher. – Kirill Kostrov Oct 27 '22 at 12:22
  • Tested on API 33 (Android Studio Flamingo 2022.2.1) - works like a charm. – Andrei Veshtard Apr 22 '23 at 19:47
  • 2023 update - following the direction from @IgorGanapolsky from this answer https://stackoverflow.com/a/72566489/1701589 and then updating the config.ini file as described above worked like a charm for API 31! – whodeee Jul 13 '23 at 15:46
4

Start by installing the Play Store package in SDK Manager. You can follow the steps on this video.

After that step, edit the config.ini file located in:

C:\Users\USER\.android\avd\DEVICE_ID

Or you can also click on Show on Disk in the device options.

Change the following variables to:

PlayStore.enabled = true
image.sysdir.1=system-images\android-27\google_apis_playstore\x86\
tag.display=Google Play
tag.id=google_apis_playstore

Once done, restart the device, and Play store will be installed and ready to use.

Lucas Gola
  • 41
  • 1
3

Download Google apps (GoogleLoginService.apk , GoogleServicesFramework.apk , Phonesky.apk) from http://wiki.rootzwiki.com/Google_Apps#Universal_Packages_2

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

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*

Refer: to this SO Post

Community
  • 1
  • 1
Randyka Yudhistira
  • 3,612
  • 1
  • 26
  • 41
  • 3
    /system not in /proc/mounts – Peter Cullen Jun 25 '18 at 08:47
  • in the emulator, with whatever tools are the latest as of Feb, 2017, the emulator needs to be launched from the command line with: `-writable-system` https://stackoverflow.com/a/42280124/3003905 – vitek6491 Jan 26 '21 at 19:33
1

On new version of sdk, you could browse:

C:\Users\{$User}\AppData\Local\Android\sdk\tools

Create avd from command line:

android create avd --name bphone --package "system-images;android-23;google_apis;x86_64"

There will be a question asking you to custom profile, say yes, then an asking to install CH Play or not, just type yes.

Then, open AVD Manager inside Android Studio to reconfig. Notes: Remember to change CPU/ABI to x86

biesior
  • 55,576
  • 10
  • 125
  • 182
Chien Tran
  • 133
  • 2
  • 11
1
  1. Choose device that support play market

  2. Choose your android version ( I I recommend the "R" version )

  3. Choose x86 image ( Target- GOOGLE PLAY, NOT Google APIs! )

Fin Loik
  • 21
  • 3
  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - [From Review](/review/late-answers/32956845) – Gabriele Mariotti Oct 20 '22 at 12:16
  • Not available for Android versions earlier than 9 – Kirill Kostrov Oct 27 '22 at 12:13
0

All this is not necessary on the latest MM API images.

All that was needed for me was to:

adb remount
adb push Phonesky.apk /system/priv-app/.
adb stop && adb restart
Mogsdad
  • 44,709
  • 21
  • 151
  • 275
ganklah
  • 25
  • 2