微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Android Gradle风格的语言支持少于Main

我希望有3种产品口味,其中一种口味比Main更少.
例如,只支持/ values-fr.
Gradle中是否有过滤功能?谢谢.

解决方法:

Android Gradle Build System开始,自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.

在“基本”样本中:

defaultConfig {
    ...
    resConfig "en"
    resConfigs "nodpi", "hdpi"
}

因此,请尝试以下方法来实现您的要求:

productFlavors {
    ...
    frOnly {
        resConfig "fr"
    }
    ...
}

请注意,您可能还想包括* dpi,port,land等

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐