Android App Development
iOS App Development
Flutter App Development
Cross Platform App Development
Hire on-demand project developers and turn your idea into working reality.
Big thanks to Webkul and his team for helping get Opencart 220.127.116.11 release ready!
Updated 29 July 2020
Android product flavors are variants of your app. It is very useful when you want to create multiple versions of your app. This means you can generate different versions or variants of your app using a single codebase.
Product flavors are a powerful feature of the Gradle plugin from Android Studio to create customized versions of products. They form part of what we call Build Variants.
Build Variants 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.
Build Type applies different build and packaging settings. An example of build types are “Debug” and “Release”.
For creating product flavors in android, we just need to add productFlavors block inside the android block in app-level build.gradle file.
You can now create source sets folders app/src/admin/ and app/src/customer/ parallel to app/src/main/. The common classes and resources can stay in app/src/main while the flavor dependent code can go in the respective folders.
Switch to project view in the left panel and then expand all directories until src and then right-click on src then navigate to
new > Folder > Res Folder
Then you’ll see a popup with two fields
Target Source set is nothing but the source code directories for selected flavor.
The New folder location is the location where the file will be created.
Similarly, we can create a directory for all flavored build types if necessary.
Creating a java directory for each flavor is similar to resource directories creation. The only difference is that we select a java folder instead of the Res folder.
Build variant combines your build types and product flavors. Sync your project after you update your build.gradle, select Build > Select Build Variant in the menu bar, and you will see the different Build Variants auto-generated when you added the Product flavors.
Your email address will not be published. Required fields are marked*
Save my name email and website in this browser for the next time I comment.
Be the first to comment.
Enquiry or Requirement
If you have more details or questions, you can reply to the received confirmation email.