假设我有这个目录结构:
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 对于 flavor1 和 flavor2 都是通用的,因此 values、values-fr 和 values-de 应该被打包
values-fr is common for both flavor1 and flavor2, and so values, values-fr and values-de should get packaged
flavor3 应该只打包 values 和 values-de.所以我只需要从 flavor3 中排除 values-fr 资源文件夹.
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/'
}
}
<小时>
编辑
对于上面的示例,我发现这个包含仅德语的工作解决方案使用:
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'
}
}
您还可以在这里查看ICU的国家代码列表.
You can also check the list of country codes from ICU here.
最终的工作解决方案是包含一种语言 - 在这种情况下,只有德语(de):
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'
}
}
作为参考,您还可以查看 ICU 这里的国家代码列表.
As a reference, you can also check the list of country codes from ICU here.
这篇关于使用 gradle 构建特定的 Android Product Flavor 时,我可以排除区域资源(例如 values-fr)吗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
Android 上的数字软键盘Numeric Soft Keyboard on Android(Android 上的数字软键盘)
带有软键盘和“返回"的 EditText按钮EditText with soft keyboard and quot;Backquot; button(带有软键盘和“返回的 EditText按钮)
在 Android 上的应用程序中内置自定义“键盘&quoCustom #39;Keyboard#39; built in an application on Android(在 Android 上的应用程序中内置自定义“键盘)
如何在 Android 的移动网站中强制使用带有数字的How to force keyboard with numbers in mobile website in Android(如何在 Android 的移动网站中强制使用带有数字的键盘)
启动 Activity 时自动弹出键盘Automatic popping up keyboard on start Activity(启动 Activity 时自动弹出键盘)
如何制作 Android EditView“完成"按钮并在单击时How do I make an Android EditView #39;Done#39; button and hide the keyboard when clicked?(如何制作 Android EditView“完成按钮并在单击时隐藏