I want to change version name for app flavors but only if it's a debug build.
(e.g. debug builds will have versions like 1.0.1 D (DEBUG) 555 or 1.0.1 P (DEBUG) 555, however I want the release builds only to have version like 1.0.1) How can I achieve this?
Basically I have these build types:
buildTypes {
debug {
versionNameSuffix " (DEBUG) " + mBuild
}
release {
runProguard true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), file('proguard-project.txt')
signingConfig signingConfigs.release
}
}
and these flavors (for different api environment):
productFlavors {
dev {
versionName = android.defaultConfig.versionName + " D"
}
prod {
versionName = android.defaultConfig.versionName + " P"
}
}
Is there any way how to make release builds without product flavors version name change?
I've tried to set the version name dynamically via
buildTypes.each { buildType ->
if(buildType.name == 'debug') {
productFlavors.dev.versionName = android.defaultConfig.versionName + " D"
}
}
but this results in
Could not find property 'dev' on GroupableProductFlavorDsl container.