In my build.gradle
, I'm defining 2 different flavor dimensions:
//list flavorDimensions in override priority order
flavorDimensions 'flavor', 'platform'
//assign each productFlavor a corresponding flavorDimension
productFlavors {
flavor1 {
dimension 'flavor'
applicationId "com.flavor1"
}
flavor2 {
dimension 'flavor'
applicationId "com.flavor2"
}
mobile {
dimension 'platform'
applicationIdSuffix '.mobile'
minSdkVersion 22
}
tv {
dimension 'platform'
applicationIdSuffix '.tv'
minSdkVersion 21
}
}
I would like to be able to set versionCode
and versionName
based on the combinations, so each of the following could have it's own version info:
- flavor1Mobile
- versionName = 1.0.0
- versionCode = 3
- flavor1Tv
- versionName = 1.0.2
- versionCode = 5
- flavor2Mobile
- versionName = 3.0.0
- versionCode = 10
- flavor2Tv
- versionName = 2.0.0
- versionCode = 4
Was able to build a solution by combining the solutions from :
https://developer.android.com/studio/build/gradle-tips#configure-dynamic-version-codes