我正在尝试在模拟器上运行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来解决我的问题:
根据设计,adb root命令仅在开发版本中有效(即eng和userdebug,默认情况下ro.debuggable = 1)。或者,您可以使用修改过的adbd二进制文件(不检查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.
我不太确定如何解析此错误消息。这是否意味着系统映像已经可写?
答案 0 :(得分:4)
我检查了Google提供的一些模拟器。 它们都是用户二进制文件,而不是工程二进制文件。 您可以使用“ adb shell”命令自己检查它。 如果命令行以“#”开头,则为工程师构建。如果以“ $”开头,则为用户构建。例如:
只有工程师构建才能授予您root权限。您不能将用户版本更改为工程师版本,但可以对其进行“ root”操作。 请检查"How to get root access on Android emulator?"了解更多信息。
答案 1 :(得分:0)
选择一个没有标记为“Google Play”的模拟器系统映像。