I'm trying to setup different build variants for Android Studio 3.0 and gradle plugin 3.0, but Android Studio doesn't create build variant for each my flavor. Gradle build is successfull but I don't know how to make productionapiRealese and germanyapiRelease build variants. How can I make it?
My flavors:
flavorDimensions "pr", "ger"
productFlavors {
productionapi {
provider "pk"
dimension "pr"
}
germanyapi {
provider "sd"
dimension "ger"
}
}
And my build variants:
NOTE: By default, the Android Studio will generate "debug" and "release" Build Types for your project. So, to change a Build Type, all you need to do is just select your Build Type from the Build Variant and after the project sync, you are good to go.
Change the build variant By default, Android Studio builds the debug version of your app, which is intended for use only during development, when you click Run. To change the build variant Android Studio uses, select Build > Select Build Variant in the menu bar.
You use same core ingredients to make the base but will use different toppings for each one to have a different taste. Similarly, android apps can have the same base functionalities with changes to some of the features like styles, logo etc. This can be achieved using product flavours.
Android Product Flavors are used to create different app versions. App versions can be free or paid. They can have different themes and texts. They can use different environments or APIs. Let's assign two product flavors free and paid in our application.
First of all read this article in detail.
As far as I understand you are mixing flavors using the information you can find in this section "Combine multiple product flavors with flavor dimensions".
Just remove this:
flavorDimensions "pr", "ger"
and this from each flavor:
dimension "ger"
dimension "pr"
Just focus on the first part of the section "Configure Product Flavors":
android {
...
defaultConfig {...}
buildTypes {...}
flavorDimensions "default"
productFlavors {
productionapi {
applicationIdSuffix ".prod"
versionNameSuffix "-prod"
}
germanyapi {
applicationIdSuffix ".german"
versionNameSuffix "-german"
}
}
}
Doing that you will get a build variant for each flavor
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