问题描述
我需要从风味中删除特定的 res 文件夹.
sourceSets {主要的 {manifest.srcFile 'AndroidManifest.
但是 drawable-mdpi 文件夹仍然会出现在 apk 中.
所以谁能请说明我犯了什么错误.
谢谢维维克
我终于解决了这个问题!
我找到了这个链接.>
这样做了:
将一个
这个文件被放置在我名为 lite ("src/lite/res/raw") 的正确目录结构中
这样,res/hd 文件夹的内容就不会包含在 lite builds 中,有效地将我的 lite build apk 大小减少了 50%
更新:要排除一些不同风格的图像,您必须将图像放在assets"文件夹中,并在 gradle 中声明:
风味 {aaptOptions {ignoreAssetsPattern '/folder:*.jpg:*.png'//使用:作为分隔符}}
我还了解到/res/raw 文件夹中不能有子文件夹.
I have a requirement to remove a specific res folder from a flavour.
sourceSets {
main {
manifest.srcFile 'AndroidManifest.
But still drawable-mdpi folder is coming to the apk.
So could anyone please specify what mistake am I making.
ThanksVivek
I finally solved this problem!
I have found this link.
And did this:
add an
<?
this file is placed in the correct directory structure for my flavor called lite ("src/lite/res/raw")
This way, contents of res/hd folder are not included in lite builds, effectively reducing my lite build apk size by 50%
Update: to exclude some images from different flavors, you have to put the images in the "assets" folder, and in gradle declare:
flavor {
aaptOptions {
ignoreAssetsPattern '/folder:*.jpg:*.png' //use : as delimiter
}
}
I also learned that you can't have subfolders in /res/raw folder.
这篇关于如何从 gradle 构建风格中排除 res 文件夹?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!