Product flavors represent different versions of your app that you may release to users, such as free and paid versions of your app.
You can customize product flavors to use different code and resources, while sharing and reusing the parts that are common to all versions of your app. Product flavors are optional and you must create them manually.
Questions tagged [android-flavors]
106 questions
3
votes
1 answer
Can't build release apk with multi flavors in Flutter?
I'm using Flutter (version 1.17.4) for developing Android and config multi Flavors for running multi-environment.
My source code has 3 environment: dev (devlopment), uat (QC), prod (Production).
Source:…
Huu Bao Nguyen
- 445
- 1
- 6
- 24
3
votes
1 answer
How to change application colors with Flavors in Android
In my application, I have 2 flavors, and I want to change the application's color (res/color) for each of this flavors!
Please see my code below at build.gradle file :
flavorDimensions "default"
productFlavors {
app1 {
applicationId…
Dr Circle
- 41
- 5
3
votes
1 answer
Setting process.env variable from Android Studio flavors
I want to be able to access a variable in my metro.config.js.
On iOS this can be achieved by adding a User Defined variable in the Build Settings tab. This is accessible with process.env.MY_VAR. The value of MY_VAR can be changed depending on which…
Dan
- 4,211
- 4
- 29
- 55
3
votes
2 answers
Disable R8 for specific flavors
I want to disable R8 for a specific flavor of my app (so setting android.enableR8=false). Does anybody know how to do it, or if it is even possible?
Can I maybe somehow have designated gradle.properties files, or how would that work?
Tim Strehlow
- 168
- 13
3
votes
0 answers
How to define a number of properties at once on a flavor level
So I have a three-option menu, which can show (on a flavor level) either one of the options (no matter which), two of the options, three of them or none. What is the best way to set a property in which I can define the visible options for each…
Noterezeck
- 402
- 4
- 17
3
votes
2 answers
android BuildConfig.BUILD_TYPE always in release status
I am implementing a new functionality that depending on whether the application is running, debug or release, choose between two url.
This is the code that I use insidel gradle to choose which url use ->
In the line below, is where I want to get…
Liru
- 191
- 1
- 2
- 10
3
votes
3 answers
Flavor specific code
Consider an Activity MainActivity with a fragment MainFragment. The fragment has some complex layout hierarchy and a view group Frame which comes from a library com.framer:frame_me:1.1.
If I have 2 flavours foo and bar, and I want this Frame to be…
Sourabh
- 7,371
- 9
- 45
- 86
3
votes
2 answers
FLAVOR: run from Android Studio fails - run from device works
I'm trying to have same activity name in different flavors, and install the right one for each flavor.
build.gradle :
android {
....
buildscript {
productFlavors {
flavor1 {
applicationId…
RedHat
- 167
- 10
3
votes
5 answers
How to hide or add menu items for Flavor?
I have an app that has 3 different flavors, full, part1 and part2.
All different flavors have different package names, so I can ship them as different apps.
Now I want that only part1 gets a menu item called Reload. The other 2 flavors shouldn't…
Terry
- 12,591
- 12
- 51
- 84
2
votes
1 answer
Android Build with Kotlin DSL - how to access flavor extra properties?
Traditionally, in Groovy, it was possible to define flavor-specific variables in the ext
{} block, but switching to Kotlin DSL it seems that the extra map has the project scope.
It looks like it is possible to force a flavor scope for extras by…
Mcingwe
- 2,065
- 2
- 17
- 16
2
votes
2 answers
Android: Add library module in particular flavor only
In my android application, I have 2 library modules that need to be included conditionally based on flavor. Following is the application structure
:app:library1:library2
And app has 2 flavors, so it will generate 2 apk's, one free version and…
Mahantesh M Ambi
- 766
- 1
- 10
- 25
2
votes
0 answers
Three flavor dimensions, want to cover two
My Android app has three flavor dimensions. Let's call them Color, Size, and Shape. So I have (Blue|Red)(Small|Large)(Round|Square).
Is it possible to have a source folder for blueSmall that covers both blueSmallRound and blueSmallSquare? If I go…
Seva Alekseyev
- 55,897
- 22
- 151
- 252
2
votes
1 answer
Can I have different classes (using flavors) in a library module for different application modules?
I have two applications: Application Module A and Application Module B. They both use Library Module X.
Inside Library Module X I have some different behaviors depending of which app is using the library. I thougth about three alternatives to…
Will Glück
- 1,182
- 10
- 17
2
votes
0 answers
Content provider issue while creating flavor in android application
I had created the flavor for the android project.
Below is the changes i had implemented in gradle file.
android {
compileSdkVersion 28
buildToolsVersion '28.0.3'
defaultConfig {
applicationId "com.collegemobile.free.free"
…
ios developer
- 3,057
- 2
- 43
- 93
2
votes
0 answers
Different signingConfig in multi-dimensional build flavors
Small example will describe the case:
flavorDimensions 'shape', 'api'
productFlavors {
fruit {
dimension "shape"
}
vegtable {
dimension "shape"
}
production {
…
Максим Петлюк
- 774
- 10
- 17