如果我不在 Android 中压缩纯文本文件,它会在 APK 中被压缩吗? [英] If I don't compress a plain text file in Android, will it be compressed in the APK anyway?

查看:36
本文介绍了如果我不在 Android 中压缩纯文本文件,它会在 APK 中被压缩吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在考虑是否要压缩我在应用程序中包含的大约 1.5 MB 的纯文本文件.我可以用 zip 将它压缩到 400k 并在应用程序中解压缩它,但这只是另外一件事.如果我不这样做,它会在 APK 中被压缩吗?有什么特别的地方我可以把它放在这里吗?我真的只关心下载大小.

I'm debating with myself whether or not to compress a plain text file I'm including in my application that is about 1.5 MB. I can compress it to 400k with zip and unzip it in the application, but that's just one more thing to mess with. If I don't do that, will it get compressed anyway in the APK? Is there a special place I could put it to make this happen? I'm really only concerned with download size.

推荐答案

文件根据扩展名进行压缩:

Files are compressed based on their extension:

/* these formats are already compressed, or don't compress well */
static const char* kNoCompressExt[] = {
    ".jpg", ".jpeg", ".png", ".gif",
    ".wav", ".mp2", ".mp3", ".ogg", ".aac",
    ".mpg", ".mpeg", ".mid", ".midi", ".smf", ".jet",
    ".rtttl", ".imy", ".xmf", ".mp4", ".m4a",
    ".m4v", ".3gp", ".3gpp", ".3g2", ".3gpp2",
    ".amr", ".awb", ".wma", ".wmv"
};

来源

如果它不是其中之一,它将在构建 apk 时被压缩.

If it's not one of those it will be compressed when building the apk.

这篇关于如果我不在 Android 中压缩纯文本文件,它会在 APK 中被压缩吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆