"adbd cannot run as root in production builds" 即使选择了 'debug' 构建变体?
"adbd cannot run as root in production builds" even though the 'debug' build variant is selected?
我正在尝试将 Android 模拟器指向本地 VM,为此我需要 adb root
。但是,我收到此错误:
$ adb root
adbd cannot run as root in production builds
然而我是 p2p-app
的 运行 的构建变体是 debug
:
p2p-app
模块的 build.gradle
包括以下内容:
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
shell 命令与任何应用程序的构建变体无关。该命令只是尝试在具有 root 权限的目标设备上重新启动 adbd
(d
代表守护程序)。这是设备(模拟器)图像构建配置的问题。
在 Android 模拟器配置的情况下,无法授予 root 权限。此外,它完全是多余的,因为 adbd
和模拟器的 shell
与库存设备(a.k.a 非根 )相比具有更高的特权。
此外,可以找到关于库存设备和模拟器之间差异的非常小的额外解释 here。
在 之后,我设法通过从 Google APIs 系统映像而不是 创建模拟器来克服这个限制Google播放一首(见下面的截图)。
使用这个模拟器我能够adb root
:
$ adb root
restarting adbd as root
我正在尝试将 Android 模拟器指向本地 VM,为此我需要 adb root
。但是,我收到此错误:
$ adb root
adbd cannot run as root in production builds
然而我是 p2p-app
的 运行 的构建变体是 debug
:
p2p-app
模块的 build.gradle
包括以下内容:
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
shell 命令与任何应用程序的构建变体无关。该命令只是尝试在具有 root 权限的目标设备上重新启动 adbd
(d
代表守护程序)。这是设备(模拟器)图像构建配置的问题。
在 Android 模拟器配置的情况下,无法授予 root 权限。此外,它完全是多余的,因为 adbd
和模拟器的 shell
与库存设备(a.k.a 非根 )相比具有更高的特权。
此外,可以找到关于库存设备和模拟器之间差异的非常小的额外解释 here。
在
使用这个模拟器我能够adb root
:
$ adb root
restarting adbd as root