I'm wondering how to create different build configurations, having different constants for debug and release builds using Android Studio (things like, server addresses, API keys,…).
The Android build system compiles app resources and source code, and packages them into APKs or Android App Bundles that you can test, deploy, sign, and distribute.
Flavor Dimensions is a way to group flavors by a name. For now, we're using just a single group. Add the following line in your defaultConfig block: flavorDimensions "default" Now syncing the gradle would give you the following product flavors: Android Build Variants combine build types and product flavors.
Edit the build.gradle
file in your module and add any of the following to your android{}
container.
signingConfigs {
release {
storeFile file("path relative to the root of the project")
storePassword "PASSWORD!"
keyAlias "projectname"
keyPassword "PASSWORD!"
}
}
buildTypes {
debug {
versionNameSuffix "-DEBUG"
packageNameSuffix ".debug"
}
release {
debuggable false
signingConfig signingConfigs.release
}
debugRelease.initWith(buildTypes.release)
debugRelease {
debuggable true
packageNameSuffix '.debugrelease'
signingConfig signingConfigs.release
}
}
}
This adds 3 build types (release, debugRelease and debug)
both release and debugRelease use the same keys and debugRelease is a copy of Release.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With