简体   繁体   English

从构建/导出到APK的Exclude / assets文件夹

[英]Exclude /assets folder from building/exporting it to APK

I use expansion files in my project, and I have placed all my assets into expansion file. 我在项目中使用扩展文件,并将所有资产放入扩展文件中。 So I access the assets from expansion file. 所以我从扩展文件中访问资产。 Now that all my assets are in expansion file. 现在我的所有资产都在扩展文件中。 I don't want to build them while building android application, but I don't want also to remove them from project path as they are source controlled with SVN. 我不想在构建android应用程序时构建它们,但我不想将它们从项目路径中删除,因为它们是由SVN控制的。 I tried to use eclipse->exclude form build which has no effect. 我尝试使用eclipse-> exclude form build,它没有效果。 So can any one suggest is there way in Eclipse to exclude asset folder? 因此,任何人都可以建议在Eclipse中排除资产文件夹吗?

Why don't you rename assets folder? 你为什么不重命名assets文件夹? Maybe tomorrow you'll want to use the assets folder. 也许明天你会想要使用assets文件夹。 You better not touch special android folders and create your own. 你最好不要触摸特殊的android文件夹并创建自己的文件夹。

Usually I create _assets and _drawable folders. 通常我创建_assets_drawable文件夹。 Such folders (starting with underscore) are not processed by android build. 这些文件夹(以下划线开头)不由android build处理。

If you're using Gradle build you can use android.aaptOptions to configure this: 如果您正在使用Gradle构建,则可以使用android.aaptOptions来配置:

android {
    aaptOptions {
        def defaultIgnorePattern = '!.svn:!.git:!.ds_store:!*.scc:.*:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~'
        ignoreAssetsPattern defaultIgnorePattern + ':descript.ion:!*.yuml'
    }
}

I use it to not package descript.ion files in general and yuml diagrams which I keep in src/main/assets next to my DB scripts. 我用它来不包装一般的descript.ion文件和yuml图表,我保存在我的数据库脚本旁边的src/main/assets

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM