android - 即使选择了“调试”构建变体,“adbd 无法在生产构建中以 root 身份运行”?
问题描述
我正在尝试将 Android 模拟器指向本地 VM,为此我需要adb root
. 但是,我收到此错误:
$ adb root
adbd cannot run as root in production builds
然而,我正在运行的构建变体p2p-app
是debug
:
该模块包括以下内容build.gradle
:p2p-app
android {
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
debuggable false
signingConfig signingConfigs.release
}
debug {
testCoverageEnabled = true
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
debuggable true
versionNameSuffix '-' + gitBranchName()
applicationIdSuffix '.fifa'
ext.betaDistributionReleaseNotesFilePath = "fabric-changelog.txt"
ext.betaDistributionGroupAliases = "android-engineers"
}
}
}
由于该debug
变体具有debuggable true
,我希望有可能获得对模拟器的 root 访问权限?
解决方案
在ADB root is not working on emulator之后,我设法通过从Google API系统映像而不是Google Play映像创建模拟器来克服此限制(请参见下面的屏幕截图)。
有了这个模拟器,我能够adb root
:
$ adb root
restarting adbd as root
推荐阅读
- python - 如何获得一块 Python Pandas .loc 行来引用原始数据框,而不是依次运行?
- reactjs - 当状态是数据库表时,如何从子级更改父级的状态?
- python - Django 用户表单未显示在管理页面中
- javascript - React Datepicker 包括没有周末的未来几天
- r - 如何编写R函数
- sitefinity - sitefinity ActionResult 缺少查询字符串
- xml - XSLT:如何调用以字符串形式给出的用户定义函数
- python - 如何在 Jupyter 笔记本中使用 Pandas 永久更改数据框样式?
- python - 具有多个键的 Python 字典列表
- sql - 在 SQL Server 中选择以显示表 OnHand、Sale 和 Purchase 中的所有不同行,其中一个/或 Qty 字段不为空