D
DevOps & CI/CDMedium30 XP4 min read

How do you reduce Flutter app size for production?

TL;DR: Key techniques: enable split-debug-info, use --tree-shake-icons, build APKs by ABI (--split-per-abi), use deferred components for large features, compress assets, and use vector images (SVG) instead of raster. Analyze with flutter build apk --analyze-size.

Full Answer

App size directly impacts install conversion: every 10MB increase = ~1% fewer installs. Target: <20MB for base APK, <100MB for AAB on Play Store.

Biggest Size Wins

  • --split-per-abi: generate separate APKs for arm64, arm, x86_64 — each 60-70% smaller than fat APK
  • --tree-shake-icons: removes unused Material icon font glyphs (~300KB)
  • --split-debug-info=path: moves debug symbols out of binary (~5MB saving)
  • Deferred components: defer large features (AR, heavy screens) until needed
  • Use flutter_svg for vector images instead of multiple raster resolutions
🎯

Use 'flutter build apk --analyze-size --target-platform android-arm64' to generate a size report. It shows which packages, assets, and Dart code are largest — target the top 5.

Code Examples

shellProduction build optimization flags
Output
// Without optimization: fat APK ~80MB
// With --split-per-abi: arm64 APK ~25MB
// App Bundle: Play delivers optimized APK per device
// --obfuscate: makes reverse engineering harder

Common Mistakes

  • Uploading a fat APK to Play Store instead of an App Bundle — Play Store serves all ABIs to all devices
  • Not using --split-debug-info — debug symbols inflate the binary by 5-10MB and are unnecessary at runtime

Interview Tip

💡

Mention the size/install rate correlation: Google research shows a 1% install rate drop per 6MB added. Knowing --analyze-size and targeting the output's top packages shows production experience.

#app-size#optimization#tree-shaking#deferred#split-apk