Installing Google Play Store in android emulator

I am trying to install Play Store in AVD emulator. Google APIS build And it fails over and over. So I started searching for solutions. But none of them worked.

Reason? here it is

android@Debian-101-buster-64-minimal:~/Downloads$ adb install 'Google Play Store_v17.1.16-all [0] [PR] 274697545_apkpure.com.apk'
adb: failed to install Google Play Store_v17.1.16-all [0] [PR] 274697545_apkpure.com.apk: Failure [INSTALL_FAILED_UPDATE_INCOMPATIBLE: Package com.android.vending signatures do not match the previously installed version; ignoring!]
android@Debian-101-buster-64-minimal:~/Downloads$  

Ok. A package is already installed with package name com.android.vending and that is definitely not Play store

Then what is it? I found that too!

android@Debian-101-buster-64-minimal:~$ adb shell pm path com.android.vending
package:/system/app/LicenseChecker/LicenseChecker.apk

Output of dumpsys

    android@Debian-101-buster-64-minimal:~$ adb shell dumpsys package com.android.vending
Service Resolver Table:
  Non-Data Actions:
      com.android.vending.licensing.ILicensingService:
        dbab1b8 com.android.vending/.licensing.LicensingService filter 2371e08
          Action: "com.android.vending.licensing.ILicensingService"
          AutoVerify=false

Permissions:
  Permission [com.android.vending.CHECK_LICENSE] (6f3eb91):
    sourcePackage=com.android.vending
    uid=10055 gids=null type=0 prot=normal
    perm=Permission{ac7aaf6 com.android.vending.CHECK_LICENSE}
    packageSetting=PackageSetting{d5eeef7 com.android.vending/10055}

Key Set Manager:
  [com.android.vending]
      Signing KeySets: 4

Packages:
  Package [com.android.vending] (d5eeef7):
    userId=10055
    pkg=Package{8453164 com.android.vending}
    codePath=/system/app/LicenseChecker
    resourcePath=/system/app/LicenseChecker
    legacyNativeLibraryDir=/system/app/LicenseChecker/lib
    primaryCpuAbi=null
    secondaryCpuAbi=null
    versionCode=1801 minSdk=25 targetSdk=25
    versionName=1.8
    splits=[base]
    apkSigningVersion=2
    applicationInfo=ApplicationInfo{1daafcd com.android.vending}
    flags=[ SYSTEM HAS_CODE ALLOW_CLEAR_USER_DATA ALLOW_BACKUP ]
    privateFlags=[ RESIZEABLE_ACTIVITIES ]
    dataDir=/data/user/0/com.android.vending
    supportsScreens=[small, medium, large, xlarge, resizeable, anyDensity]
    timeStamp=2019-04-12 22:25:12
    firstInstallTime=2019-04-12 22:25:12
    lastUpdateTime=2019-04-12 22:25:12
    signatures=PackageSignatures{13b8082 [ef3d224c]}
    installPermissionsFixed=false installStatus=1
    pkgFlags=[ SYSTEM HAS_CODE ALLOW_CLEAR_USER_DATA ALLOW_BACKUP ]
    declared permissions:
      com.android.vending.CHECK_LICENSE: prot=normal, INSTALLED
    requested permissions:
      android.permission.INTERNET
      android.permission.USE_CREDENTIALS
      com.google.android.googleapps.permission.GOOGLE_AUTH
      com.google.android.googleapps.permission.GOOGLE_AUTH.android
      com.google.android.providers.gsf.permission.READ_GSERVICES
    install permissions:
      android.permission.USE_CREDENTIALS: granted=true
      com.google.android.providers.gsf.permission.READ_GSERVICES: granted=true
      com.google.android.googleapps.permission.GOOGLE_AUTH: granted=true
      android.permission.INTERNET: granted=true
      com.google.android.googleapps.permission.GOOGLE_AUTH.android: granted=true
    User 0: ceDataInode=114773 installed=true hidden=false suspended=false stopped=false notLaunched=false enabled=1
      gids=[3003]
      runtime permissions:


Dexopt state:
  [com.android.vending]
    Instruction Set: x86
      path: /system/app/LicenseChecker/LicenseChecker.apk
      status: /system/app/LicenseChecker/oat/x86/LicenseChecker.odex [compilation_filter=speed, status=kOatUpToDate]


Compiler stats:
  [com.android.vending]
    (No recorded stats)
android@Debian-101-buster-64-minimal:~$ 

And this package is just impossible to remove/uninstall!

I tried overriding this with playstore app from Open Gapps and Apkpure

Every attempt was failure. I got the Icon for one time but it'll keep crashing.

How can i install the play store app in the Google APIS build in AVD emulator

I need to use it instead of Play Store build


The Google Play Store has officially since several years been preinstalled in the Android Emulator. While it's hard to install in some emulators, it is easy to have for API 24 and above by just selecting from the AVD manager an emulator that already has Google Play.

In the Android Studio AVD Manager choose a virtual device configuration that has the Google Play store icon next to it, and then select one of the system images that have the label "Google Play". See this release note: https://androidstudio.googleblog.com/2017/04/android-studio-24-preview-4-is-now.html.

Android Studio AVD Manager with Google Play Store support


The process of installing the Play Store in emulators where it is not pre-installed is described in the article Install Google Play Store in an Android Emulator.

The following is a summary of the article:

  • Download the Google Play packages from The Open GApps Project

    enter image description here

  • Unzip the file and extract the highlighted from the Core folder:

    enter image description here

  • To decompress these tar.lz files may require installing the lzip package, then use the command:

    tar -xf vending-x86.tar.lz
    

    The end-result would be:

    enter image description here

  • Check the privileged apps directory for missing APKs:

    adb shell
    ls system/priv-app
    

    enter image description here

    In the above image the APKs related to Google services are already installed, so we only need to install the APK from the vending-x86 folder with the name Phonesky.apk.

  • Exit the emulator with Ctrl+D

  • Push this APK to the emulator:

    $ANDROID_HOME/tools/emulator @avd_name -writable-system
    adb remount
    adb push ~/Phonesky.apk /system/priv-app/
    adb shell stop && adb shell start
    
  • The Google Play Store icon should now be in the apps drawer.