I want to have 3 product flavors, and one of them will have less language support than Main. For example, only support /values-fr. Is there a filter function in Gradle? Thanks.
From Android Gradle Build System, since version 0.7.0:
- New option on product Flavor (and defaultConfig) allow filtering of resources through the -c option of aapt
- You can pass single value (resConfig) or multiple values (resConfigs) through the DSL.
- All values from the default config and flavors get combined and passed to aapt.
- See "basic" sample.
In the "basic" sample:
defaultConfig {
...
resConfig "en"
resConfigs "nodpi", "hdpi"
}
So, try the following to achieve what you asked for:
productFlavors {
...
frOnly {
resConfig "fr"
}
...
}
Note that you might also want to include *dpi, port, land, etc.. as well
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