Last active
December 15, 2021 21:17
-
-
Save StephaneBg/23476891fb37f80f9dc3e7bddade7c79 to your computer and use it in GitHub Desktop.
Set different signing configs with multiple flavors and dimensions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
signingConfigs { | |
vanillaPaid { | |
... | |
} | |
vanillaFree { | |
... | |
} | |
chocolatePaid { | |
... | |
} | |
chocolateFree { | |
... | |
} | |
} | |
flavorDimensions "taste", "type" | |
productFlavors { | |
vanilla { | |
dimension "taste" | |
applicationIdSuffix ".vanilla" | |
} | |
chocolate { | |
dimension "taste" | |
applicationIdSuffix ".chocolate" | |
} | |
free { | |
dimension "type" | |
... | |
} | |
paid { | |
dimension "type" | |
... | |
} | |
} | |
applicationVariants.all { variant -> | |
if (variant.name.equals("vanillaPaidRelease")) { | |
variant.mergedFlavor.setSigningConfig(signingConfigs.vanillaPaid) | |
} else if (variant.name.equals("vanillaFreeRelease")) { | |
variant.mergedFlavor.setSigningConfig(signingConfigs.vanillaFree) | |
} else if (variant.name.equals("chocolatePaidRelease")) { | |
variant.mergedFlavor.setSigningConfig(signingConfigs.chocolatePaid) | |
} else if (variant.name.equals("chocolateFreeRelease")) { | |
variant.mergedFlavor.setSigningConfig(signingConfigs.chocolateFree) | |
} | |
} | |
buildTypes { | |
release { | |
... | |
} | |
debug { | |
... | |
} | |
} |
Hi! Is this solution still working? Because in my case I always get unsigned apk-file.
I can confirm. It doesn`t work.
Have been struggling with setting signingconfigs based on merged flavors for a while now. Can confirm Gradle outputs an apk file with the unsigned name suffix using this approach. But, the APK itself is actually signed. So this solution does work, only the output file name is incorrect.
It doesn't work - I received unsigned apk, and validate by jarsinger I received information that apk it is not signed.
Only getters exists in kotlin-gradle on mergedFlavor :/
Not working for me when using Android Studio 4.0+
Is working for me when using Android Studio 3.6
any lead ? stuck with this issue
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi! Is this solution still working? Because in my case I always get unsigned apk-file.