If I don't compress a plain text file in Android, will it be compressed in the APK anyway?

喜欢而已 提交于 2019-12-18 17:27:27

问题


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.


回答1:


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"
};

Source

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



来源:https://stackoverflow.com/questions/6694932/if-i-dont-compress-a-plain-text-file-in-android-will-it-be-compressed-in-the-a

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