Say I have this directory structure:
app
--src
   |--main
   |   |--java
   |   |--res
   |       |--drawable
   |       |--values
   |       |--values-fr
   |       |--values-de
   |
   |--flavor1
   |   |--res
   |       |--drawable
   |
   |--flavor2
   |   |--res
   |       |--drawable
   |
   |--flavor3
       |--res
           |--drawable
values-fr is common for both flavor1 and flavor2, and so values, values-fr and values-de should get packaged
flavor3 should only package values and values-de. So I need to exclude the values-fr resource folder from the flavor3 only.
I've tried loads of combinations such as those below, but cannot figure it out, or even if it's possible.
sourceSets {
    flavor3 {
        res.exclude 'values-fr/**'
        res.exclude 'values-fr/'
    }
}
EDIT
I found this working solution to include only German for the above example using:
productFlavors {
    flavour3 {
        resConfigs 'de' // include '-de' resources, along with default 'values'
    }
}
You can also check the list of country codes from ICU here.
The final working solution is to include a language - in this case, only German (de):
productFlavors {
    flavour3 {
        resConfigs 'de' // include '-de' resources, along with default 'values'
    }
}
As a reference, you can also check the list of country codes from ICU here.
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