I have two build variants in my app, one is an standard app edition and the second one is a customization app.
productFlavors {
customConfig {
minSdkVersion 14
applicationId 'es.com.custom'
targetSdkVersion 22
versionCode 3
versionName '3.0.0'
}
standard {
minSdkVersion 14
applicationId 'es.com.standard'
targetSdkVersion 22
versionCode 3
versionName '3.0.0'
}
For the customization I have to implement new features, but just for the customization, so those new features will be not available on the standard version. I am not sure what i have to do.
1.- Two classes , one with the standard requirements and one with the custom requirements
2.- In the standard class do something like:
if (getPackageName()==customConfig )
// do the custom things
else
//do the standard things
You must create source directories for each flavor. So you will be able to maintain a separate file for the specific flavor.
Please go through the link that will help you.
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. Although you do not configure build variants directly, you do configure the build types and product flavors that form them.
if(BuildConfig.Flavor.equals("customConfig"))
{
}
else
{
}
Read Building multiple flavors of an Android
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With