If I have 3 flavors flavor1, flavor2 and flavour3, each flavor has Dev,Pat and Prod "sub-flavours" versions which different parameters , but each main flavor have different resources.
So I have now 9 different flavors, but only 3 different resource folders). I would like the same "sub-flavors" to use the same resources.
How can I do that? I have seen in the documentation about the flavorDimensions but not sure how to configure the resource folder.
At the moment I am using something like
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'
}
}
You need Gradle flavours eg. flavor1
, flavor2
etc, as well as Build Types like dev
, prod
etc.
See the example from: 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/
Also, this question is very similar How can I specify per flavor buildType sourceSets?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With