Reputation: 1858
I need to manage two different client code in single project so i have used productFlavors and defined flavor for each client.
Now the question is source code base is same for both but need to define different applicationId
like
How would I make flavor so that code remain same for both and appId
different?
Upvotes: 1
Views: 2063
Reputation: 13549
Android will create main/
source set and directories for everything you want to share between all your build variants, so no need for creating new source set in your case.
And you could use applicationIdSuffix
for different build variants,which is appended to the "base" application id when calculating the final application id for a variant.
For example:-
flavorDimensions "appMode"
productFlavors {
free {
dimension "appMode"
applicationIdSuffix ".free" //the application id of 'free' is com.example.com.free
}
paid {
dimension "appMode"
applicationIdSuffix ".paid"//the application id of 'paid' is com.example.com.paid
}
}
The applicationIdSuffix will be appended to the package name(base application id),
com.example.com
is the package name in above example.
Upvotes: 3
Reputation: 3295
add the code block set applicationId
like below :
productFlavors {
abc {
resValue "string", "build_type", "Version " + defaultConfig.versionName
applicationId "com.abc"
}
def {
resValue "string", "build_type", "Version " + defaultConfig.versionName
applicationId "com.def"
}
Upvotes: 2