I'm trying to point an Android emulator to a local VM, for which I need to adb root. However, I'm getting this error:
$ adb root
adbd cannot run as root in production builds
Yet the build variant I am running of the p2p-app is debug:

The build.gradle for the p2p-app module includes the following:
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"
}
}
}
Since the debug variant has debuggable true, I would expect it to be possible to get root access to the emulator?
Following ADB root is not working on emulator, I managed to overcome this limitation by creating an emulator from a Google APIs system image, not a Google Play one (see screenshot below).

With this emulator I was able to adb root:
$ adb root
restarting adbd as root
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With