I have inherited a project which has the following flavor set up in gradle build file:
productFlavors {
def STRING = "String"
def BOOLEAN = "boolean"
def TRUE = "true"
def FALSE = "false"
def BASE_ENDPOINT = "BASE_ENDPOINT"
mock {
applicationId "com.example.myapp.mock"
buildConfigField STRING, BASE_ENDPOINT, '"mock://localhost/gt"'
}
qa {
applicationId "ca.example.myapp"
buildConfigField STRING, BASE_ENDPOINT, '"https://qa-somesite.com/gt"'
}
qaInternal {
applicationId ".ca.example.myapp.int"
buildConfigField STRING, BASE_ENDPOINT, '"https://internal-somesite.com/gt"'
}
beta {
applicationId "com.example.myapp.beta"
buildConfigField STRING, BASE_ENDPOINT, '"https://somesite.com/gt"'
}
prod {
applicationId "ca.ca.example.myapp"
buildConfigField STRING, BASE_ENDPOINT, '"https://somesite.com/gt"'
}
}
nothing special going on there just flavors for production qa, mocking , etc.
This is just for for a particular country though. Its for USA. So these flavors are all for USA. I need to use the same app. I'd like to create flavors for another country called France. The france flavors have different configurations.
i was thinking i could do something like this:
flavorDimensions "country","buildtype"
to get me the flavors by country. But then how would i create my own mock,qa,qaInternal,etc flavors for the new country.
So to be clear my end goal is to have product flavors for a new country called france given the code i've pasted above all in android studio.
UPDATE: Let me be more precise on what i desire and the issue. Look at the current product flavors: mock, qa, qaInternal,beta and prod. They all pretain to information about a USA build. This already exists in code. The code is currently built for USA customers. Now i have been asked to make the code also available for French customers so i need a french build.
The issue is things like the applicationID, and many buildConfigField are going to be different in the french build. How can i engineer a solution where i can have for example, a french mock, a french qa, a french qaInternal ,french beta, and a french prod just like i currently have for the USA build ?
The issue has nothing to do with locale per say, its just that we have two products a USA product and we want a french product which will have a different configuration then USA.
take for example the mock flavor. For french i need this to happen:
mock {
applicationId "french-com.example.mock"
versionName = versionOverride + 'french-mock'
buildConfigField STRING, BASE_ENDPOINT, '"mock://localhost/french-gt"'
}
I think you should create multiple
buildType
s instead of flavors. if you have build types France and USA, and flavors mock, qa and ... , then you would have these build variants : qaUSA , qaFrance, mockUSA, mockFrance and etc.here is
build.gradle
example :