I have a project with multiple library modules in it. I want to create unique flavors in one the modules, but I've encountered a strange error that I'm having trouble solving.
In my module's gradle file I have the following:
android {
defaultConfig {
testApplicationId "com.mytestApplication"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
productFlavors {
flav1 {
buildConfigField 'String', 'PROJECT', '"Flav1"'
}
flav2{
buildConfigField 'String', 'PROJECT', '"Flav2"'
}
}
}
But I keep getting the error:
Error:Cannot add task ':myaccessorModule:jarRelease' as a task with that name already exists.
if my build.gradle file is written like this:
android {
defaultConfig {
testApplicationId "com.mytestApplication"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
productFlavors {
flav1 {
buildConfigField 'String', 'PROJECT', '"Flav1"'
}
}
}
Then it will actually show me the flav1Debug and flav1Release options in the Build Variant window.
I'm wondering why it fails when trying to use two or more flavors? I have not defined any flavors in any of my other modules. All documentation I've seen makes this look pretty easy. I've also tried adding these flavors to my module through the project structure GUI, but i'm getting the same results. How do I get this module to have multiple flavors?
Cheers.