I have following fields in ProductFlavors of build.gradle,
productFlavors {
Flavor1 {
applicationId \"com.example.A\"
buildConfigField \
You can use following steps:
In your app level build.gradle:
buildscript {
ext{
appId="com.example.A"
Id=123
}
...
}
change your fields as follows:
productFlavors {
Flavor1 {
applicationId appId
buildConfigField 'int', 'ID', "$Id"
}
}
From jenkins pass the parameters:
gradlew assesmbleFlavor1 -PappId="${APPLICATION_ID}" -PId="${ID}"
Where ${APPLICATION_ID}
and ${ID}
are parameters defined in jenkins