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?