I'm trying to run the adb root
command on an emulator; this is the only device I have attached:
$ adb devices
List of devices attached
emulator-5554 device
However, I'm getting the following error message:
$ adb root
adbd cannot run as root in production builds
I've tried following this answer, adb shell su works but adb root does not, to solve my problem:
By design adb root command works in development builds only (i.e. eng and userdebug which have ro.debuggable=1 by default). Alternatively you could use modified adbd binary (which does not check for ro.debuggable)
It is not clear to me, however, how I can change the build into a development build instead of a production one?
Update I've found some additional instructions which lead me to believe that for this to work, you need to make your emulator a 'writable system' (cf. How to make system partition in AVD in emulator writable). However, if I try
$ emulator -avd Nexus_5X_API_28 -writable-system
emulator: WARNING: System image is writable
emulator: ERROR: Running multiple emulators with the same AVD is an experimental feature.
Please use -read-only flag to enable this feature.
I'm not really sure how to parse this error message; does this mean that the system image is already writable?
I checked some emulator provided by Google. They are all user binary, not engineer binary. You can check it yourself by using "adb shell" command. If command line starts with "#", it's engineer build. If it starts with "$", it's user build. For example:
Only engineer build can give you root permission. You can not change user build to engineer build but you can 'root' it. Please check "How to get root access on Android emulator?" for more information.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With