为什么未对齐APK是必要的? [英] why unaligned apk is needed?

查看:421
本文介绍了为什么未对齐APK是必要的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Android的摇篮产生APK两个二进制文件:未对齐并对准

Android gradle produces apk in two binaries: unaligned and aligned.

借助文件说......

一旦你已经签署了APK用你的私钥,该文件运行zipalign。此工具可确保所有pssed uncom $ P $数据开始与特定的字节对齐,相对于该文件的开头。当在设备上安装的对准确保在4字节边界提供了一种性能优化。当对齐,Android系统能读取的mmap(文件),即使它们包含二进制数据对齐限制,而不是从包中复制所有数据。这样做的好处是在RAM中的由正在运行的应用所消耗的量的减少。

Once you have signed the APK with your private key, run zipalign on the file. This tool ensures that all uncompressed data starts with a particular byte alignment, relative to the start of the file. Ensuring alignment at 4-byte boundaries provides a performance optimization when installed on a device. When aligned, the Android system is able to read files with mmap(), even if they contain binary data with alignment restrictions, rather than copying all of the data from the package. The benefit is a reduction in the amount of RAM consumed by the running application.

好像对齐apk文件,强烈建议派发。对我来说,我只使用的对齐的APK结果产品而忽略的对齐的APK。

Seems like aligned apk is strongly recommended to distribute. For me, I only use aligned apk as a result product and ignore unaligned apk.

难道不对齐的apk开发过程中有什么特殊用途?

Does unaligned apk have any special usage during development?

推荐答案

这是一个两步的过程。未对齐APK只是一个中间产品。

It is a two step process. The unaligned apk is just an intermediate product.

  1. 生成未对齐的apk
  2. 未对齐得到一致并产生一致的apk

这篇关于为什么未对齐APK是必要的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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