Can anyone explain to me how I can use for each of my flavors more then just the main and the flavor specific java/src directories ? My goal is to have directories which are used by more than one flavor but not all of them.
For example I have 3 flavors : A1, A2 and B.
Is this possible ? If so, what should I put in my build.gradle file ?
And as a bonus question, can I chose in which order gradle goes looking for files in my different directories ?
For example if I have a.png declared in both A/src and A1/src, can I tell gradle to first look for this file in A/src, and only if nothing is found look for it in A1/src ?
As described here
As mentioned above, each sourceSet can define multiple resource folders.
You can define multiple resource folder. For example something like this:
android {
...
sourceSets {
main {
//....
res.srcDirs = ['/src/main/res']
}
flavorA1 {
res.srcDirs = ['/src/flavor1/res', '/src/commonA/res']
}
flavorA2 {
res.srcDirs = ['/src/flavor2/res', '/src/commonA/res']
}
//.....other flavors
}
}