Ignoring files from Android APK

别等时光非礼了梦想. 提交于 2019-12-18 04:33:10

问题


Is it possible to ignore files from being packaged into the Android APK? For instance, I have my .psd files in the same folder as their .png counterparts, and all the .psd files get packaged up.

I know I can move them outside of the folder, but I like having them in all together and would prefer not to if possible


回答1:


This is actually supported in the Android Asset Packaging Tool (AAPT).

I always put my psd-like files in the resource directories like this:

/res/drawable/_pre_production/ic_launcher.psd

Any _pre_production directory will not be added to the APK.

With this approach they're in a sub-directory of the actual images' directory, but I don't see the problem with that. It is still neatly organized. ;)




回答2:


An Ant script will do the trick. If you are using proguard, even that script may be good enough for u.




回答3:


Use the Maven Android Plugin and declare your resources with a matching pattern that excluded the relevant file types you dont want added (e.g. */.psd). Check out the documentation for the resource plugin and look at the Maven Android Plugin Samples project .. specifically the MorseFlash application I created and the resource plugin related setup.




回答4:


You can try using the maven android plugin and adding some logic to the build phase.




回答5:


If you are using Eclipse, right-click the file and select "Exclude from build path"



来源:https://stackoverflow.com/questions/4789187/ignoring-files-from-android-apk

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!