| title | Analyze App Bundle Size |
|---|---|
| impact | HIGH |
| tags | app-size, ruler, emerge-tools, thinning |
Measure iOS and Android app download/install sizes using Ruler, App Store Connect, and Emerge Tools.
# Android (Ruler)
cd android && ./gradlew analyzeReleaseBundle
# iOS (Xcode export with thinning)
cd ios && xcodebuild -exportArchive \
-archivePath MyApp.xcarchive \
-exportPath ./export \
-exportOptionsPlist ExportOptions.plist
# Check: App Thinning Size Report.txt- App download size is too large
- Users complain about storage usage
- App approaching store limits
- Comparing releases for size regression
Note: This skill involves interpreting visual size reports (Ruler, Emerge Tools X-Ray). AI agents cannot yet process screenshots autonomously. Use this as a guide while reviewing the reports manually, or await MCP-based visual feedback integration (see roadmap).
| Metric | Description | User Impact |
|---|---|---|
| Download Size | Compressed, transferred over network | Download time, data usage |
| Install Size | Uncompressed, on device storage | Storage space |
Google finding: Every 6 MB increase reduces installs by 1%.
Add to android/build.gradle:
buildscript {
dependencies {
classpath("com.spotify.ruler:ruler-gradle-plugin:2.0.0-beta-3")
}
}Add to android/app/build.gradle:
apply plugin: "com.spotify.ruler"
ruler {
abi.set("arm64-v8a") // Target architecture
locale.set("en")
screenDensity.set(480)
sdkVersion.set(34)
}cd android
./gradlew analyzeReleaseBundleOpens HTML report with:
- Download size
- Install size
- Component breakdown (biggest → smallest)
ruler {
verification {
downloadSizeThreshold = 20 * 1024 * 1024 // 20 MB
installSizeThreshold = 50 * 1024 * 1024 // 50 MB
}
}Build fails if thresholds exceeded.
After uploading to TestFlight:
- Open App Store Connect
- Go to your build
- View size table by device variant
Note: TestFlight builds include debug data, App Store builds slightly larger due to DRM.
- Archive app: Product → Archive
- In Organizer, click Distribute App
- Select Custom
- Choose App Thinning: All compatible device variants
Or in ExportOptions.plist:
<key>thinning</key>
<string><thin-for-all-variants></string>Creates folder with:
- Universal IPA: All variants combined
- Thinned IPAs: One per device variant
- App Thinning Size Report.txt:
Variant: SampleApp-<UUID>.ipa
App + On Demand Resources size: 3.5 MB compressed, 10.6 MB uncompressed
App size: 3.5 MB compressed, 10.6 MB uncompressed
- Compressed = Download size
- Uncompressed = Install size
Third-party service with visual analysis.
Upload IPA, APK, or AAB through their web interface or CI integration.
- X-Ray: Treemap visualization (like source-map-explorer for binaries)
- Shows Frameworks (hermes.framework), Mach-O sections (TEXT, DATA), etc.
- Color-coded: Binaries, Localizations, Fonts, Asset Catalogs, Videos, CoreML Models
- Visible components:
main.jsbundle(JS code), RCT modules, DYLD sections
- Breakdown: Component-by-component size
- Insights: Automated suggestions (use with caution)
Caution: Some suggestions may not apply to React Native (e.g., "remove Hermes").
| Tool | Platform | Accuracy | CI Integration |
|---|---|---|---|
| Ruler | Android | High | Yes (Gradle) |
| App Store Connect | iOS | Highest | No |
| Xcode Export | iOS | High | Yes (xcodebuild) |
| Emerge Tools | Both | High | Yes (API) |
| Component | Approximate Size |
|---|---|
| Hermes engine | ~2-3 MB |
| React Native core | ~3-5 MB |
| JavaScript bundle | 1-10 MB |
| Assets (images, etc.) | Varies |
Baseline empty app: ~6-10 MB download
| Optimization | Size Reduction |
|---|---|
| Enable R8 (Android) | ~30% |
| Remove unused polyfills | 400+ KB |
| Asset catalog (iOS) | 10-50% of assets |
| Tree shaking | 10-15% |
# Android release bundle size
cd android && ./gradlew bundleRelease
# Check: android/app/build/outputs/bundle/release/
# iOS archive
cd ios && xcodebuild -workspace ios/MyApp.xcworkspace \
-scheme MyApp \
-configuration Release \
-archivePath MyApp.xcarchive \
archive
# Export with thinning report
cd ios && xcodebuild -exportArchive \
-archivePath MyApp.xcarchive \
-exportPath ./export \
-exportOptionsPlist ExportOptions.plist- bundle-r8-android.md - Reduce Android size
- bundle-native-assets.md - Optimize asset delivery
- bundle-analyze-js.md - JS bundle analysis
