Android – how to avoid duplicate resources in multi flavor applications
If I have three flavors, flavor 1, flavor 2 and flavor 3, each flavor has dev, pat and prod "sub flavors" versions. Their parameters are different, but each main flavor has different resources
So I now have 9 different flavors, but only 3 different resource folders). I want to use the same "sub style" to use the same resources
How can I do this? I saw about flavor dimensions in the document, but I'm not sure how to configure the resource folder
I'm using something similar right now
sourceSets {
flavor1_dev{
res.srcDir 'src/flavor1/res'
}
flavor1_prod{
res.srcDir 'src/flavor1/res'
}
flavor2_dev{
res.srcDir 'src/flavor2/res'
}
flavor2_prod{
res.srcDir 'src/flavor2/res'
}
}
resolvent:
You need gradle flavor, such as. Flavor 1, flavor 2, etc., and dev, prod, etc
See the following example: http://developer.android.com/tools/building/configuring-gradle.html and http://tools.android.com/tech-docs/new-build-system/user-guide#TOC -Sourcesets-and-Dependencies
For example:
Android.sourcesets.flavor1debug location Src / flavor1debug/
Android.sourcesets.flavor1release location Src / flavor1release/
Android.sourcesets.flavor2debug location Src / flavor2debug/
Android.sourcesets.flavor2release location Src / flavor2release/
In addition, how can I specify per flavor BuildType sourcesets? Very similar