How to change Android Studio's default build flavor? How to change Android Studio's default build flavor? android android

How to change Android Studio's default build flavor?


With Android Studio 3.5+ you can set default falvors:

android {  flavorDimensions "stage", "target"  productFlavors {    develop {      getIsDefault().set(true) // that does the magic      dimension "stage"      ...

When using KTS it lookes like this:

android {  flavorDimensions("stage", "target")  productFlavors {    create("develop") {      isDefault = true      dimension("stage")      ...


Change the order in which you define them in productFlavors. The IDE always loads the first flavor it finds there as the default.


What actually worked for me is enabling "Android Studio Preferences -> Experimental -> Only sync the active variant". It keeps the selected build variant when reopening AS or when re-syncing, basically solving the original problem.

AS/AGP v4.1.