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 3.0.3.7 release ready!
Deniel Kerr
Founder. Opencart
Top Partners
Build variant is used to create different version of application in single project. Each Build variant creates different versions of our app. Like, you wanna make any music application with two version, one is free and other one is paid.
Build variant is result of build type and product flavor.
Example: Build type : debug, release Product Flavor : first, second
Build Variant : firstDebug, firstRelease, secondDebug, secondRelease
Gradle creates every possible combination of build type and product flavor as build variant by default.
Build type defines in build.gradle files. Android Studio provides two type of build type. 1. debug 2. release When we create any project in Android Studio, it automitacally creates build type for us. The debug build type doesn’t apprear in build file, Android Studio configures it with debuggable true. You can add debug block in build.gradle file and configure its setting. Debug version is used for testing purpose. If you wanna create upload app on play store, you need to create releasable version. Android Studio configure build type with debuggable true. If you wanna upload release version on play store, so you need to set it false in build.gradle in release block.
For product flavor, we add block in build.gradle same as build type. The product flavors support the same properties as defaultConfig—this is because defaultConfig actually belongs to the ProductFlavor class. You can change any property of defaultConfig in product flavor block and set different for all product flavor. For example, there are two applications for cab booking, one for driver and one for customer. Both app code is written in one project. So, you need to define two product flavor and set different applicationid.
Product flavors must belongs to product dimension. It is basically group of product flavors. You must assign all flavors to a flavor dimension; otherwise, you will get the build error : ERROR: All flavors must now belong to a named flavor dimension.
Add following line in builder gradle :
Suppose, you have different Home page of application for guest user and paid user. So, according to product flavour, home page will be called.
Gradle creates every possible combination of build type and product flavor as build variant by default. If you wanna remove any build variant, you can filter it.
Hope, this blog is helpful for you.
Also, check following link : Android Build
Your email address will not be published. Required fields are marked*
Name*
Email*
Save my name email and website in this browser for the next time I comment.
Be the first to comment.
We use cookies to personalize your experience. By continuing to visit this website you agree to our use of cookies. Learn more about privacy policy
Great Product, Great Team, and Great Support Service. And if you want to add more features to the product, they can submit any idea that comes to your mind. They really care about their clients and we are really happy and honored to deal with Webkul.
Osama
USA
India
Global
Name
Email
Enquiry or Requirement
If you have more details or questions, you can reply to the received confirmation email.