Android Productflavors in gradle Configure Build Variant

Android Productflavors in gradle Configure Build Variant

What is Productflavors?

Productflavors is very good Feature of gradle system.Productflavors helps you to build variant Application. Each build variant represents a different version of your app that you can build. For example, you might want to build one version of your app that’s Bronze, with a limited set of content, and another Silver which is small paid version that includes more.Gold which contents full content and functionality, and You can also build different versions of your app that target different devices, based on API level or other device variations.

lets take exaple we need to build three varient of product.

Product Flavors are

  • Bronze
  • Silver
  • Gold

How To add Build Variant?

go to build.config file of your app

Change the application ID for build variant


if you want to use custom package name than

In case of Use Of GCM Write of custom action receiver category android:name=”${packageName}”

Use different Application Icon

In manifest file

in file

you can use variant res and asset folder as per flavours

create inner folder as like below image

Folder Structure Build Varient

You can Select Test Variant from android Studio for testing for that

Build>Select Build Variant

select build Variant android studio
select build Variant 2


Add Constant at Compile Time

by adding this you can add constant values related flavour

detail study of product flavour is Here


Leave a Comment