ADB根目录在模拟器上不起作用(不能在生产版本中以根目录运行) [英] ADB root is not working on emulator (cannot run as root in production builds)
问题描述
我刚刚更新了模拟器26.0.3,现在我无法为新创建的模拟器运行 adb root
命令。
I have just updated emulator 26.0.3, now I cannot run adb root
command for new created emulator.
显示的错误如下:
adbd无法在生产版本中以root用户身份运行
我已杀死并重新启动 adbd
,例如:
I have killed and restart adbd
like:
adb kill-server
adb devices
没有帮助,有什么主意吗?
Nothing helps, any ideas?
我不确定有什么区别以及如何选择不同的版本,但是如果启用了以下设置,则
创建时,它具有根目录。
I am not sure what is the difference and how to select different build but, if following settings are enabled while creating, then it has root.
推荐答案
[信用属于@Merk
[Credit belongs to @Merk but this should be posted as an answer rather than a comment.]
要启用root访问权限,请使用仿真器映像,例如
To enable root access, use an emulator image like
Google AP是Intel x86 Atom系统映像
Google APIs Intel x86 Atom System Image
不是
Google Play Intel x86 Atom系统映像
Google Play Intel x86 Atom System Image
要对其进行测试,请运行 adb root
。应该说
To test it, run adb root
. It should say
以root身份重新启动adbd
restarting adbd as root
or
adbd已经作为root运行
adbd is already running as root
不是
adbd无法在生产版本中作为root用户运行
adbd cannot run as root in production builds
或者,要进行测试,请运行 adb shell
,如果提示以 $
,运行 su
。您应该得到一个#
提示。
Alternatively, to test it, run adb shell
, and if the prompt ends with $
, run su
. You should get a #
prompt.
步骤:要安装和使用模拟器可以作为root用户运行的图像:
Steps: To install and use an emulator image that can run as root:
- 在Android Studio中,使用菜单命令工具> AVD管理器。
- 单击 +创建虚拟设备... 按钮。
- 选择虚拟硬件
-
选择系统映像。选择以下任何一项:
- In Android Studio, use the menu command Tools > AVD Manager.
- Click the +Create Virtual Device... button.
- Select the virtual Hardware.
Select the System Image. Pick any of these:
Intel x86 Atom系统映像
英特尔x86 Atom_64系统映像
Google API英特尔x86 Atom系统映像
Google API Intel x86 Atom_64系统映像。
这些设备在第二列中没有Playstore图标。 (请勿选择 Google Play ...系统映像。那些不能以root用户身份运行。)
These are the devices that do not have a Playstore icon in the second column. (Do NOT pick "Google Play ... System Image". Those are the ones that cannot run as root.)
这篇关于ADB根目录在模拟器上不起作用(不能在生产版本中以根目录运行)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!