Force to use same certificate to sign different "buildTypes" that are configured for a particular "productFlavor"?

Viewed 1467

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:

  1. developRelease and developDebug should be signed with only signingConfigs.develop

  2. productionRelease and productionDebug should be signed with only signingConfigs.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?

2 Answers
Related