Suppose I have an Android app with three build types:
buildTypes {
release {
....
}
optRelease {
....
}
debug {
....
What I did is :
Created product flavors:
android {
flavorDimensions 'tier'
compileSdkVersion 27
defaultConfig {
applicationId "com.example.sample"
minSdkVersion 15
targetSdkVersion 27
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
--------------
}
debug {
debuggable true
}
}
productFlavors {
qc {
applicationIdSuffix ".qc"
dimension "tier"
}
production {
applicationIdSuffix ".production"
dimension "tier"
}
}
}
Allow dependencies to choose the build types like below
dependencies {
qcDebugCompile project(path: ':libName', configuration: "debug")
qcReleaseCompile project(path: ':libName', configuration: "release")
productionDebugCompile project(path: ':libName', configuration: "debug")
productionReleaseCompile project(path: ':libName', configuration: "release")
...
}