10

https://developer.android.com/studio/run/managing-avds#system-image says

To ensure app security and a consistent experience with physical devices, system images with the Google Play Store included are signed with a release key, which means that you cannot get elevated privileges (root) with these images. If you require elevated privileges (root) to aid with your app troubleshooting, you can use the Android Open Source Project (AOSP) system images that do not include Google apps or services.

But what if I wanted both root AND Google services? how could I do that?

Thanks!

2

2 Answers 2

2

First go here:

https://opengapps.org

I selected this option:

Platform Android Variant
x86 6 pico

but newer Android should work as well. Then open Android Studio. On "Select Hardware" screen, select a device without "Play Store" icon.

With Google APIs

On "System Image" screen, I selected this option:

API Level ABI Target
24 x86 Android 7 Google APIs

but newer APIs should work as well. You should only need one file from the Zip archive:

Core\vending-x86.tar.lz

Inside this will be another file:

vending-x86\nodpi\priv-app\Phonesky\Phonesky.apk

Now, start the device:

emulator -list-avds
emulator -avd Pixel_3a_XL_API_24 -writable-system

Next, install Google Play Store. Note that you cannot use the normal method of drag APK to device screen, or you will get one of these errors:

The APK failed to install.<br/> Error: Could not parse error string

The APK failed to install.<br/> Error: INSTALL_FAILED_UPDATE_INCOMPATIBLE:
Package com.android.vending signatures do not match the previously installed
version; ignoring!

The APK failed to install.<br/> Error: INSTALL_PARSE_FAILED_NO_CERTIFICATES:
Failed to collect certificates from /data/app/vmdl1047870024.tmp/base.apk:
META-INF/BNDLTOOL.SF indicates /data/app/vmdl1047870024.tmp/base.apk is signed
using APK Signature Scheme v2, but no such signature was found. Signature
stripped?

Install like this:

adb root
adb remount
adb push Phonesky.apk /system/priv-app
adb reboot

After reboot, you should then be able to start Google Play Store as normal.

Without Google APIs

Using the method above with Google APIs image, you still get some apps such as YouTube. If you want to install different version of one of these apps, use this method. On "System Image" screen, I selected this option:

API Level ABI Target
24 x86 Android 7

but newer APIs should work as well. You need these files from the Zip archive:

Core\gmscore-x86.tar.lz
Core\vending-x86.tar.lz

Then extract these from the above files:

gmscore-x86\nodpi\priv-app\PrebuiltGmsCore\PrebuiltGmsCore.apk
vending-x86\nodpi\priv-app\Phonesky\Phonesky.apk

Use the same method above to install the APKs. After reboot, you should then be able to install YouTube or whatever app. Note that unlike above, you dont actually need to run the Google Play setup or even start the Google Play app at the end.

External links

https://github.com/89z/googleplay/blob/f98b78a7/docs/play-store.md

6
  • Does doing this make the emulator rooted? Or in other words, apps that need root access can run on the emulator?
    – Andrew T.
    Feb 21, 2022 at 15:07
  • 1
    adb root provides root access only to the shell for commandline use, not to the apps. Testing root apps requires rooting the emulator anyways - be it the Play Store image or not. Feb 21, 2022 at 17:38
  • @Zombo please calm down. And reread Andrew's comment. I don't "disagree" with your answer. It's just a partial solution to the rooting problem. For many users root is required to test apps, not just to issue commands. Your use case seems to be very limited. Feb 21, 2022 at 18:46
  • I appreciate everyone including your contribution, but at this point, looks like we don't know what the asker's real use case is without clarifying (and I'm afraid they don't seem to visit this site anymore). It just seems that the other answer, Irfan, and I were thinking about having a rooted emulator (i.e. access to su) for testing apps/commands that require root access from the emulator/device directly...
    – Andrew T.
    Feb 22, 2022 at 11:00
  • 1
    Did not work for me : on Android 11.0 google api image - Emulator gets stuck on boot after installing Phonesky.apk
    – Sudhir N
    Feb 3 at 17:25
0

I think thing the best course of action would be to download and install a third-party Android Emulator. If you are on Windows, I would recommend Bluestacks. As it can be easily rooted with this tutorial here. If you need any help, feel free to reply to this message.

Hope this helps you out!

Red Prez

1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .