I\'ve got a project where I have several device-specific product flavors, and each flavor needs to be signed with a different config:
productFlavors {
n
Works on 2.2.1
buildTypes {
release {
}
debug {
signingConfig android.buildTypes.release.signingConfig
}
}
I got another solution after android plugin build. 1.1.3
productFlavors {
nexus7 {
signingConfig signingConfigs.nexus7
}
nexus4 {
signingConfig signingConfigs.nexus4
}
}
buildTypes {
release {
debuggable false
zipAlignEnabled true
}
debug {
initWith release
debuggable true
zipAlignEnabled false
}
}
As build type "release" will use flavor signing config (as there is no specification), after debug init with release build, it will also has the same signing config.
Build type "debug" needs to be init with "release" as if signing config is not provided, it will use Android default debug signing key.
Update
The problem is that android.buildTypes.debug.signingConfig has a default value while release does not.
The solution may be breakage in the future.
Anyway, still work with android plugin build 2.3.2
Try adding this to your build.gradle. It will specify which signingConfig to use for each flavor when building the debug build type:
buildTypes {
debug {
productFlavors.nexus4.signingConfig signingConfigs.nexus4
productFlavors.nexus7.signingConfig signingConfigs.nexus7
}
}