android - "adb root"命令即使在模拟器上也返回 "adbd cannot run as root in production builds"?

标签 android adb

我正在尝试在模拟器上运行 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)

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

更新 我发现了一些额外的说明,这些说明使我相信要使其正常工作,您需要使您的模拟器成为“可写系统”(参见 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.

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

最佳答案

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

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

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

关于android - "adb root"命令即使在模拟器上也返回 "adbd cannot run as root in production builds"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53662102/

相关文章:

java - 纯java adb客户端

android - 如何解决 "Waiting for Debugger"消息?

java - Libgdx 空指针异常

android - View 组及其 subview 上的 onclicklistener

java - 如何将复杂的ViewGroup复制到位图?

android - adb 不显示 nexus 5 设备

多次触发 Scrollview 的 Android onScrollChanged

android - Android 中的自定义日历 View

ubuntu - 如何在 ubuntu 下使用 adb usb 连接 android 设备

android - 当设备位于 Android P 上时,有什么方法可以使用 ADB 跳过 Android 设备设置向导?