Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"adbd cannot run as root in production builds" even though the 'debug' build variant is selected?

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:

enter image description here

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?

like image 668
Kurt Peek Avatar asked Dec 07 '18 17:12

Kurt Peek


1 Answers

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).

enter image description here

With this emulator I was able to adb root:

$ adb root
restarting adbd as root
like image 175
Kurt Peek Avatar answered Sep 27 '22 21:09

Kurt Peek