Atul Sakhala

Jun 1, 2021

1 min read

Empower your “build.gradle”

Basics and useful approach to managing the configuration when your app consists the multiple flavors.

So currently, my SDK serving multiple clients with core functionality are the same but different look and feel. You can say most of the resources may be different for different clients but java/ kotlin classes would be the same.

“build.gradle” play a vital role to achieve this using a multi-module approach.

Let’s say, we have two clients i.e X and Y. I’ll create two flavours for this

i.e Buildvariant: XDebug, XRelease, YDebug, Yrelease.

Create config.properties to add whatever configuration according to different falvours.

Here the “getConfigurationProperty” method fetches the configuration accordingly to your build flavour and applies correspondingly into your libraryVariants function. The simple and efficient way I made my Gradle file on more generic and modular concepts.

Mark clap if you like the story which encourages me to write it more

This is the way !!