1

How to know which Emulator image will contain su? I can see that often it only contains su or google play

enter image description here

Martin Zeitler
  • 1
  • 19
  • 155
  • 216

1 Answers1

0

Run adb root and you get a root shell ... otherwise su needs to be manually installed.
However, when already having a root shell available, installing it isn't much of a problem.
All images are rooted, but SDK apps requesting escalation of privileges do rely upon su.
This question here generally duplicates: How to get root access on Android emulator?

adb shell scripting must:

  • start the emulator
  • run adb root
  • run adb shell
  • remount system partition
  • adb push the su binary
  • chmod to set permissions
  • exit

Or to answer the question:

  • start the emulator
  • and check if the file exists, eg. with adb shell stat /usr/bin/su

Where stat gives this response, when it's not installed:

stat: '/usr/bin/su': No such file or directory

One could even loop all Android images installed in $ANDROID_SDK_HOME... there's no "one click" solution, but adb can be fully automated with Bash or Batch. And one wouldn't even have to run the emulator, but can mount QCOW2 as a nbd network block device.

Martin Zeitler
  • 1
  • 19
  • 155
  • 216