Wendeson Gomes
← Back to blogMobile

How a 95 MB APK became 21 MB

Oct 29, 20264 min readby Wendeson Gomes

In a mobile app built with Capacitor, the APK reached 95 MB. For an app that is, inside, a WebView loading a React front end, that number made no sense.

The reason is how Capacitor assembles the package: cap sync copies the web build into the native project, and it copies everything, including every chunk produced by lazy loading, needed or not. Scroll the page to see what happens to that weight:

PRUNElazy chunkInstalling…APK
APK
95 MB

95 MB on the phone's back

That was the APK's weight. The app is a WebView, but the package carried far more than it opens.

The way out was pruning chunks by alias before the sync, letting only what the mobile app actually loads into the APK. From 95 MB, the package dropped to 21.

The lesson goes beyond Capacitor: every tool that copies everything to be safe hides a cost. And binary size is a metric nobody looks at until the day someone has to install the app.

Every tool that copies everything to be safe hides a cost.
Next up
Supporting 3 design systems without scattering ifs through your code
→