App size reduction: the mechanical megabytes you can cut this week
Analyze the artifact first, ship an App Bundle, let R8 shrink code and resources, convert icons to vectors - then put a size budget in CI so the cleanup never repeats.
Every megabyte of app size costs installs - users on limited data plans and older devices feel it first, and both stores surface download size in the listing. The good news: the largest reductions are usually mechanical, not architectural. This guide walks the official levers on Android and iOS, roughly in the order they pay off.
Measure before you cut
Android Studio's APK Analyzer breaks a build into its real contents - DEX code, resources, assets, native libraries - so you can see which third of the binary is actually worth attacking. The equivalent on iOS is an App Thinning size report from Xcode. Teams that skip this step routinely spend a week shrinking images while an unused analytics SDK contributes more than all the images combined.
The Android levers
Publish an Android App Bundle, not a universal APK. Play generates and serves per-device APKs from the bundle, so each phone downloads only the architecture, screen density and language resources it needs. A universal APK makes every user pay for every device.
Let R8 shrink and obfuscate. Enabling the R8 app optimizer removes unused code and renames what's left; combined with resource shrinking it is typically the single biggest code-size win. Keep rules protect the code you reach by reflection - keep them narrow so R8 can do its job.
Remove unused resources. Android Studio's lint static analysis detects resources in res/ that your code never references; resource shrinking then strips them from the release build. Libraries are the usual offenders - a UI kit you use 5% of can drag in everything.
Use vector graphics where they fit. Vector drawables are resolution-independent: one file replaces the mdpi-through-xxxhdpi PNG stack, which Google's own guidance calls out as a way to greatly reduce APK footprint. Reserve raster images for photos, and prefer WebP over PNG for the rest.
The iOS levers
App Thinning does the per-device work on Apple's side: slicing delivers only the architecture and assets a device needs, and on-demand resources let you host heavier content (level packs, tutorial media) on Apple's servers and fetch it when required. Bitcode-era advice is obsolete; the current wins are asset catalog discipline (PDF/vector assets where possible), stripping unused architectures and keeping heavy media out of the initial install.
The levers both platforms share
- Audit third-party SDKs by weight. Every dependency has a size line item; the analyzer shows it. Two ad networks and a duplicate JSON library are the classic finds.
- Ship features, not feature flags' graveyards. Dead code behind old flags still ships. Delete it and let version control remember.
- Set a size budget in CI. Fail the build or at least comment on the pull request when the artifact grows more than an agreed threshold. Size regressions are far easier to catch at introduction than at audit.
A realistic first pass
Analyze the current artifact, switch to an App Bundle if you have not, enable R8 with resource shrinking, run lint's unused-resources pass and convert the icon stack to vectors. Most apps see a double-digit percentage reduction from those four alone, before any architectural work. Then put the budget in CI so you never have to do the big cleanup again.
Sources
Prepared with AI assistance and reviewed before publication. Android techniques paraphrased from Google's documentation checked on 19 November 2026; iOS App Thinning behaviour is described from Apple's standard distribution model.