请,您知道一种在合并多个 Assets 文件夹之前或合并期间如何从Android项目 Assets 文件夹中排除某些文件的方法吗?

例如:

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
  }
}

最佳答案

目前尚不可能。
packagingOptions功能不适用于Android资源或 Assets 。

09-28 02:21