I have just updated emulator 26.0.3, now I cannot run adb root
command for new created emulator.
the error shown is below:
adbd cannot run as root in production builds
I have killed and restart adbd
like:
adb kill-server
adb devices
Nothing helps, any ideas?
I am not sure what is the difference and how to select different build but,
if following settings are enabled while creating, then it has root.
[Credit belongs to @Merk but this should be posted as an answer rather than a comment.]
To enable root access, use an emulator image like
Google APIs Intel x86 Atom System Image
not
Google Play Intel x86 Atom System Image
To test it, run adb root
. It should say
restarting adbd as root
or
adbd is already running as root
not
adbd cannot run as root in production builds
Alternatively, to test it, run adb shell
, and if the prompt ends with $
, run su
. You should get a #
prompt.
Steps: To install and use an emulator image that can run as root:
- In Android Studio, use the menu command Tools > AVD Manager.
- Click the +Create Virtual Device... button.
- Select the virtual Hardware.
Select the System Image. Pick any of these:
Intel x86 Atom System Image
Intel x86 Atom_64 System Image
Google APIs Intel x86 Atom System Image
Google APIs Intel x86 Atom_64 System Image.
(Do NOT pick "Google Play ... System Image". Those are the ones that cannot run as root.)
- Click the Download button if needed.
- Finish creating your new AVD.
- Run your new AVD.
You are using the wrong emulator image if you want root access. As the error message states, root is not allowed in production builds, use an userdebug build instead.