aapt always compresses resource files
I have an Ant build script for my Android project. I’m using aapt to package various开发者_JAVA百科 resource files. I want the resources files to be uncompressed. I ‘ve tried the ‘-0′ flag but the files still get compressed! But when I build through Eclipse, the resource files are uncompressed. Why doesn’t this flag work?
Here is my aapt target in Ant:
Packaging resources and assets...
It is not the case that assets and raw resources are always uncompressed. According to an Android developer, this was a mistake in the documentation, which has apparently now been removed.
In fact, whether a resource is compressed is controlled by its file type or by the -0 flag. See Dealing with Asset Compression in Android Apps.
I know this doesn't answer your question and so should be posted as a comment, but I don't have comment posting rights yet.
Have you considered putting your resources in the res/raw/
subdirectory instead? Files placed in this directory are not compressed. Alternatively, place your files in an assets/
directory and read them using the AssetManager
if you need the original hierarchy or file names in your application.
Android documentation on resource types
精彩评论