TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Why Android APK Format is a Mistake

8 pointsby jlemoineover 12 years ago

2 comments

saurikover 12 years ago
As much as I hate the APK file format, this is not a valid reason why, as Google covered this. When you build your APK, you are more than welcome to simply not compress certain files, as the .zip file format has an algorithm that is just "store". In fact, the SDK does this by default for certain kinds of commonly-mapped files that don't benefit much from compression anyway, such as .mp3. I am not certain if aapt lets you specify other files easily, but you can always just add your own stored content using the zip tool itself.<p>Then, the normal build process has you run "zipalign" on the resulting file, which will guarantee that uncompressed files fall on boundaries that would make them efficient to memory map directly out of the APK. Finally, the AssetManager API provides an openFd() method that will open a file (which <i>must</i> be uncompressed, or you will get an IOException), return a file descriptor for that file, and tell you the offset into that file where the data for the file you wanted starts (an API sufficient to describe a range of an APK).
评论 #5114953 未加载
blibbleover 12 years ago
I'd argue that it's just a standard engineering trade-off rather than a mistake.<p>jar files have exactly the same issues.
评论 #5111052 未加载