Quick history:
Now question: how to change flavors for all modules in bulk in AndroidStudio 3.0+ without changing each application separately?
You can change the build variant to whichever one you want to build and run—just go to Build > Select Build Variant and select one from the drop-down menu. To start customizing each build variant with its own features and resources, however, you'll need to know how to create and manage source sets.
Build variants: Variants are the combination of build types and build flavors. For example, you can have a “dev paid” version of your app, which is a combination of the “dev” build type and “paid” flavor of your app.
Product flavours lets you create multiple variants of an android app while using a single codebase. To create product flavours you need to define rules in the build.
There are two settings in Android Studio to enable switching all variants at once when selecting the app variant.
The settings are "Only sync the active variant" & "Do not build Gradle task list during Gradle sync". Both of them need to be disabled, then I restarted Android Studio once and Gradle sync.
With the settings in the screenshot disabled, I went from switching and waiting for ~10 seconds per dynamic-feature module (10 in my project) to one single switch in <5 seconds.
Note: This is tested in Android Studio 4.0.1
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