Gradle:从Android资产文件夹中排除文件 [英] Gradle: Exclude file from Android assets folder

查看:1555
本文介绍了Gradle:从Android资产文件夹中排除文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请问您知道如何在合并多个资产文件夹或合并期间从Android项目资产文件夹中排除某些文件吗? 例如:

  android {
sourceSets {
main {
assets.srcDirs = [fileTree(dir: 'assets1',排除:'myfile.txt'),'assets2'] //不起作用
assets.exclude'assets1 / myfile.txt'//不起作用
assets.exclude'* * / *。txt'//不起作用
assets.exclude'* .txt'//无效
}
}

packagingOptions {
排除'assets1 / myfile.txt'//不起作用
排除'** / *。txt'//不起作用
排除'* .txt'//不起作用
}


aaptOptions {
ignoreAssetsPatternmyfile.txt//不起作用
}
}


解决方案

目前尚不可能。



packagingOptions 功能不适用于Android资源或资产。


Please, do you know a way how to exclude some file from Android project assets folder before multiple assets folders are merged or during the merge?

For example:

android {
  sourceSets {
    main {
      assets.srcDirs = [fileTree(dir: 'assets1', exclude: 'myfile.txt'), 'assets2'] // does not work
      assets.exclude 'assets1/myfile.txt' // does not work
      assets.exclude '**/*.txt' // does not work
      assets.exclude '*.txt' // does not work
    }
  }

  packagingOptions {
    exclude 'assets1/myfile.txt' // does not work
    exclude '**/*.txt' // does not work
    exclude '*.txt' // does not work either
  }


  aaptOptions {
    ignoreAssetsPattern "myfile.txt" // does not work
  }
}

解决方案

It's not possible at the moment.

The packagingOptions feature does not apply to Android resources or assets.

这篇关于Gradle:从Android资产文件夹中排除文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆