Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Gradle flavor to have less language support than Main

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.

like image 334
heavyauto Avatar asked Feb 27 '14 06:02

heavyauto


1 Answers

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

like image 166
Ladios Jonquil Avatar answered Oct 20 '22 20:10

Ladios Jonquil