简体   繁体   English

具有大量资产的较小 APK 大小?

[英]Smaller APK size with large assets?

I am creating a simple android app to view a comic book.我正在创建一个简单的 android 应用程序来查看漫画书。 The pages are large(0.5-1 mb each), high quality .png's and I am loading them into a webview to make use of the built in zoom controls.这些页面很大(每个 0.5-1 mb),高质量的 .png,我将它们加载到 web 视图中以利用内置的缩放控件。 So far I only have 17 files and the APK size is already about 16 mb.到目前为止,我只有 17 个文件,APK 大小已经大约 16 mb。 I'm looking to add over 200 files in future updates.我希望在未来的更新中添加 200 多个文件。 I can't really reduce the quality too much because there is small text that must be zoomed-in on to read.我真的不能降低质量太多,因为有必须放大才能阅读的小文本。 Any suggestions?有什么建议吗? A similar question was posted here: How to reduce App (.apk) Size , but I don't want to lose the quality of the images.这里发布了一个类似的问题: How to reduce App (.apk) Size ,但我不想失去图像的质量。 I'm not sure if it's appropriate to link to here, but you can have a look at my app by searching for Tracer (by Detour Mobile) on the android market if it helps at all.我不确定链接到这里是否合适,但是您可以通过在 android 市场上搜索 Tracer(由 Detour Mobile)来查看我的应用程序,如果它有帮助的话。 Thanks in advance.提前致谢。

You could compress them without using lossy compression- eg zipping/rarring them, but I don't believe this would gain you much more than a few kilobytes here and there.你可以在不使用有损压缩的情况下压缩它们——例如压缩/rarring它们,但我不相信这会让你在这里和那里获得超过几千字节的收益。 Otherwise, try using a more compact format than PNG, such as JPEG (you won't lose too much quality.) By the way, all of this was suggested in the referenced post.否则,请尝试使用比 PNG 更紧凑的格式,例如 JPEG(您不会损失太多质量)。顺便说一句,所有这些都在引用的帖子中得到了建议。

If you do decide to scale down the images' size somewhat, be sure to use a method like bicubic sharper- it tends to look better than others when reducing image size.如果您决定稍微缩小图像的尺寸,请务必使用像双三次锐化这样的方法 - 在缩小图像尺寸时,它往往看起来比其他方法更好。

Another option would be to download the images for the comic that is being read on-the-fly with pre-fetching so reading would not be interrupted as much.另一种选择是下载正在通过预取即时阅读的漫画的图像,这样阅读就不会被打断太多。

Consider placing your images in Assets folder as opposed to Res.考虑将您的图像放在 Assets 文件夹而不是 Res 文件夹中。 The big difference is, Assets content won't be compiled into R.java class so you will see major storage savings.最大的不同是,Assets 内容不会被编译到 R.java 类中,因此您会看到大量的存储节省。 You'd have to modify your code though as you won't be able to call up the images via the regular r.resID notation, but it's doable您必须修改您的代码,因为您将无法通过常规 r.resID 表示法调用图像,但它是可行的

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM