I have defined some product flavors in my build.gradle. I am able to successfully build them using gradlew
.
I can't figure out how I do so from the Android Studio IDE.
(My project was initially done in Eclipse then I've migrated to the Android Studio)
To write flavor specific code, create the folder with the same name as the flavor. The java classes with the same name in the flavor folders won't override the main folder. The res folder in the main should only have those directories that are common to all flavors.
Build variants are the result of Gradle using a specific set of rules to combine settings, code, and resources configured in your build types and product flavors. Although you do not configure build variants directly, you do configure the build types and product flavors that form them.
The flavor dimensions define the cartesian product that will be used to produce variants. Example: flavorDimensions("dimA", "dimB") productFlavors { row1 { ... dimension = "dimA" } row2 { ... dimension = "dimA" } row3 { ... dimension = "dimA" } col1 { ...
To change the build variant Android Studio uses, select Build > Select Build Variant in the menu bar. For projects without native/C++ code, the Build Variants panel has two columns: Module and Active Build Variant.
Build Variants appears as a vertical button along the bottom of the left edge of the workspace. If it's not visible, click the little rectangle icon on the lower left corner.
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