How to build product flavors from Android Studio?

AndroidAndroid Studio

Android Problem Overview


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)

Android Solutions


Solution 1 - Android

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.

Solution 2 - Android

You can Choose the flavor you want to run on device or emulator selecting from the BuildVariants panel

enter image description here

To generate all the apk of each flavor , you can run the Gradle build task and the files will appear in the folder yourmodule / build / ouputs / apk .

Build task can be run from the console or from the task pane Gradle

enter image description here

Solution 3 - Android

In the upper right hand corner of android studio click "gradle".

Drop down your package > tasks > build > build { DOUBLE CLICK IT }

This will begin building all your flavors.

[enter image description here

[enter image description here

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionAlexander KulyakhtinView Question on Stackoverflow
Solution 1 - AndroidKrylezView Answer on Stackoverflow
Solution 2 - AndroidxurxodevView Answer on Stackoverflow
Solution 3 - AndroidEverett WenzelView Answer on Stackoverflow