0

I have 11 flavors for an app and one Keystore for an app. I hoped to use one keystore to sign multiple product flavors like below.

signingConfigs {
    release {
        storeFile file("Users/avalon/retailr.jks")
        storePassword storePassword
        keyAlias "alias"
        keyPassword keyPassword
    }
}
...
...
productFlavors{
    flavorone {
        ...
        signingConfig signingConfigs.release
    }
    flavortwo {
        ...
        signingConfig signingConfigs.release
    }



}

However i keep getting an error during running a Configuration that The apk for your currently selected variant cannot be signed. Please specify a signing configuration for this variant (flavorone-release). Does that mean I have to make 11 different keystore configurations for the apps or is there a way i can use one ?

damunga
  • 95
  • 4
  • 11
  • Sounds more like a bug. Do you have enabled parallel execution of gradle? If yes this could be a concurrency problem (all flavors run signing at the same time). – Robert May 14 '22 at 12:41

2 Answers2

1

Have you tried like this ?

  signingConfigs {
    configFlavor1 {
        keyAlias 'abcdef'
        keyPassword 'password'
        storeFile file('keystore.jks')
        storePassword 'password'
    }

    configFlavor2 {
        keyAlias 'abcdef'
        keyPassword 'password'
        storeFile file('keystore.jks')
        storePassword 'password'
    }

}

Then in

  buildTypes {
    release {
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        productFlavors.flavor1.signingConfig signingConfigs.configFlavor1
       

        productFlavors.flavor2.signingConfig signingConfigs.configFlavor2
    }
SimpleCoder
  • 1,665
  • 1
  • 21
  • 34
  • That actually works thanks. Are there any problems/violations arising from signing the app with the same key once you upload the apps to Playstore ? – damunga May 14 '22 at 14:33
  • Where is the part that "connects" here between the package-name and the key-configuration to sign with ("configFlavor1", "configFlavor2") ? – android developer Feb 13 '23 at 08:32
0

You don't have to add multiple configs for each variant. In the app/build.gradle you can mention in the build types like following

buildTypes {
    release {
        signingConfig signingConfigs.release
    }
}

and in your signinconfig section you can have like following

signingConfigs {
        release {
            keyAlias 'keyAlias'
            keyPassword 'keyPassword'
            storePassword 'storePassword'
            storeFile file("${rootDir}/keystores/app.keystore")
        }

    }
Swayangjit
  • 1,875
  • 2
  • 13
  • 22