Background:
I am generating builds using build variant. Below are the configurations:
signingConfigs { production { storeFile file("some_path/buildsystem/keystore/some.release.keystore.jks") storePassword "somepassword" keyAlias "somekeyalias" keyPassword "some" v2SigningEnabled false } develop { storeFile file(".some_path./buildsystem/keystore/someother.debug.keystore.jks") storePassword "someother" keyAlias "someotherkeyalias" keyPassword "someother" v2SigningEnabled false } } productFlavors { production { signingConfig signingConfigs.production } develop { applicationIdSuffix ".develop" signingConfig signingConfigs.develop } } buildTypes { debug { minifyEnabled false } release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' } } Problem
As, of now for example if I talk about flavour production then productionRelease uses signingConfigs.production to sign the apk. But, productionDebug doesn't uses signingConfigs.production.
Expected output
When I generate the signed apk I want the gradle to do the following for me:
developReleaseanddevelopDebugshould be signed with onlysigningConfigs.developproductionReleaseandproductionDebugshould be signed with onlysigningConfigs.production
Another question that is similar to this which led me to do the above: SHA-1 different for buildTypes (debug and release) for same productFlavors Firebase?
1 Answers
Answers 1
Remove the signingConfig signingCongigs.develop elsewhere in the code block
And add new property within the buildTypes like
- production
- develop
Now add signingConfig to it
Thereby your updated gradle file look like as below
signingConfigs { production { storeFile file("some_path/buildsystem/keystore/some.release.keystore.jks") storePassword "somepassword" keyAlias "somekeyalias" keyPassword "some" v2SigningEnabled false } develop { storeFile file(".some_path./buildsystem/keystore/someother.debug.keystore.jks") storePassword "someother" keyAlias "someotherkeyalias" keyPassword "someother" v2SigningEnabled false } } productFlavors { production { } develop { applicationIdSuffix ".develop" } } buildTypes { /* NOTE: the debug block is not required because it is a default * buildType configuration; all of its settings are defined implicitly * by Gradle behind the scenes. */ debug { minifyEnabled false } release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' signingConfig signingConfigs.production } production { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' signingConfig signingConfigs.production } develop { minifyEnabled false signingConfig signingConfigs.develop } } In the terminal use the below gradle commmand: gradle assembleProduction to generate build with production certificates similarly gradle assembleDevelop or you can also use gradle assemble
You cannot force gradle to choose the certificates for debug property rather you could create own buildTypes
As per documentation
Automate signing your applications. Debug build variants are, by default, signed with a debug key for installation on development devices. Declare additional signing configurations for publication to the Google Play store.
0 comments:
Post a Comment