sourceSets
In the productFlavors
section, you can see which sources and resources each flavor refers to:
sourceSets { flavorBlueTest { java.srcDirs = ['src/blue/java'] res.srcDirs = ['src/blue /res'] } flavorBlueProd{ java.srcDirs = ['src/blue/java'] res.srcDirs = ['src/blue/res'] } flavorGreenTest{ java.srcDirs = ['src/green/java'] res.srcDirs = ['src/green/res'] } flavorGreenProd { java.srcDirs = ['src/green/java'] res.srcDirs = ['src/green/res'] } }
The java.srcDirs
and res.srcDirs
objects determine which folder is being referred to for a particular flavor (or flavors).
In this project, resources such as text (values.xml
) and colors (colors.xml
) are defined under the /src/main/res
folder:

As you can see, there are, besides the main
folder, two other folders: blue
and green
. Under the blue/res
and green/res
folders, you will find the files and values that override the default resources...