"adb root" 命令 returns "adbd cannot run as root in production builds" 即使在模拟器上?

"adb root" command returns "adbd cannot run as root in production builds" even on an emulator?

我正在尝试 运行 在模拟器上执行 adb root 命令;这是我附加的唯一设备:

$ adb devices
List of devices attached
emulator-5554   device

但是,我收到以下错误消息:

$ adb root
adbd cannot run as root in production builds

我尝试按照这个答案 adb shell su works but adb root does not 来解决我的问题:

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)

但是,我不清楚如何将构建更改为开发构建而不是生产构建?

更新 我发现了一些额外的说明,这些说明使我相信要使其正常工作,您需要将模拟器设置为 'writable system'(参见 How to make system partition in AVD in emulator writable)。但是,如果我尝试

$ 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.

我不太确定如何解析此错误消息;这是否意味着系统映像已经可写?

我查看了 Google 提供的一些模拟器。 它们都是用户二进制文件,而不是工程师二进制文件。 您可以使用 "adb shell" 命令自行检查。 如果命令行以“#”开头,则为工程师构建。如果以“$”开头,则为用户构建。例如:

  • jackpot2lte:/ # => 工程师构建
  • jackpot2lte:/ $ => 用户构建

只有engineer build才能给你root权限。您不能将用户构建更改为工程师构建,但您可以 'root' 它。 请检查 "How to get root access on Android emulator?" 了解更多信息。

选择未标记为“Google 播放”的模拟器系统映像。

来自 .