
In this way, adding a resource inside the paid folder makes it available only for paid versions. Gradle creates a folder for each build type, flavor and build variant, merging sources and resources. The next step is to declare resources, source code and constants for each build variant to better organize our code. We’ll talk about Build Variant later, for know just keep in mind. Click on Build Variants and you can see them listed in the pane. You can find them in Android Studio on the left side. It means that we can define different flavors when our app uses different URLs per clients, or when we have features available on a version rather than another, as it is in free and paid versions.īuild types and product flavors together create a matrix of available Build Variants. Product flavors reflect the app’s functionalities. For example, in debug build type we can have more logs than in release build type. We can create a build type for debug, test, release, staging and so on. They are similar, but let’s clarify better which are the differences between them.īuild types are relevant for developers. We can configure build types and product flavors.

Build variants can help us keep our project cleaner and maintainable.


Some of the reasons we want to add flavors to our project are to meet the requirements of different clients or to build paid and free versions, but also to share part of the code within similar apps. In this article, we’ll take a look at how to use Gradle to build different variants of our app and organize resources and source code for each build variant.
