aapt 始终压缩资源文件
我的 Android 项目有一个 Ant 构建脚本。我正在使用 aapt 来打包各种资源文件。我希望资源文件未被压缩。我已经尝试了“-0”标志,但文件仍然被压缩!但是当我通过 Eclipse 构建时,资源文件是未压缩的。为什么这个标志不起作用?
这是我在 Ant 中的 aapt 目标:
包装资源和资产...
I have an Ant build script for my Android project. I’m using aapt to package various 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...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
资产和原始资源并非总是未压缩的。 据 Android 开发者称,这是文档中的一个错误,现在显然已被删除。
事实上,资源是否压缩是由其文件类型或-0 标志控制的。请参阅处理 Android 应用中的资源压缩。
我知道这不能回答您的问题,因此应该作为评论发布,但我还没有发表评论的权利。
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.
您是否考虑过将资源放入
res/raw/
子目录中?放置在该目录中的文件不会被压缩。或者,如果您需要应用程序中的原始层次结构或文件名,请将文件放在assets/
目录中,并使用AssetManager
读取它们。有关资源类型的 Android 文档
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 anassets/
directory and read them using theAssetManager
if you need the original hierarchy or file names in your application.Android documentation on resource types