Lena Bru
Lena Bru

Reputation: 13937

Sign two buildTypes with the same certificate

I have an app that has 2 product flavors, p1 and p2 and two build types, debug and release

when i run the app p1Release or p2Release in android studio, they are each signed with the release certificate. But when I run p1Debug it's signed with the debug certificate. However I want p1Debug to be signed with the release certificate.

I've tried the following:

android {

    ...
defaultConfig {
    ...
}
productFlavors {

    p1 {
        signingConfig signingConfigs.release
    }
    p2 {
        signingConfig signingConfigs.release
    }
    p3 {
        signingConfig signingConfigs.debug
    }
}




buildTypes {

    debug {
        debuggable true
        minifyEnabled false
    }

    release {
        debuggable false

    }
}

Here I expect whenever I build p1Debug from AndroidStudio to have it signed with the release certificate. But that does not happen. but when I run p1Release it is signed with the release certificate.

How do I fix it for p1Debug ?

*note when i do : Build -> Generate signed apk -> and select the correct configuration, it does sign it correctly.

But i need it to work when i click the run button

Upvotes: 1

Views: 68

Answers (1)

TacB0sS
TacB0sS

Reputation: 10266

in general:

buildTypes {
  debug {
    signingConfig signingConfigs.release
  }
}

if you want the flavor signing config to take over:

buildTypes {
  debug {
    signingConfig null
  }
}

Upvotes: 1

Related Questions