App RN baseline ~25–40MB (iOS) / ~15–25MB (Android). Tối ưu xuống 10–20MB cho banking app, app SEA emerging market.
Android:
1. Hermes (default 0.70+): bytecode + smaller runtime → giảm 5–10MB so với JSC.
2. R8/ProGuard (default release): obfuscate + tree-shake unused Java code. Thêm rules tránh strip code dùng qua reflection:
-keep class com.facebook.react.** { *; }
-keep class com.swmansion.reanimated.** { *; }3. ABI splits (android/app/build.gradle):
splits {
abi {
enable true
reset()
include 'arm64-v8a', 'armeabi-v7a' // skip x86
universalApk false
}
}Mỗi APK chỉ chứa native lib cho 1 ABI → giảm 30–50% size. Play Store chấp nhận multi-APK.
4. App Bundle (.aab) (recommend): Google chia chunk theo device → user download chỉ phần cần. Giảm 20–30% so với universal APK.
5. Resource shrinking: shrinkResources true trong release. Bỏ asset không reference.
iOS:
1. Bitcode (deprecated từ Xcode 14): không cần config nữa.
2. App Thinning: App Store tự thinning per-device — chỉ download asset cho device đó. Active by default.
3. Strip debug symbols: Strip Linked Product = YES trong release build settings.
Cross-platform:
- Image: dùng WebP/AVIF thay PNG/JPEG. Tool:
expo-imagetự pick format. - Font subset: chỉ ship glyph cần. Tool
glyphhangerhoặc Google Webfonts subset API. - Lottie/JSON animation: minify, dedupe asset chung.
- Audit:
npx react-native-bundle-visualizerxem JS bundle.apkanalyzer(Android Studio) cho APK.
Target số 2026: một app feature trung bình nên fit trong 25MB Android, 40MB iOS install size.