|
| 1 | +--- |
| 2 | +title: Insights |
| 3 | +sidebar_order: 5250 |
| 4 | +description: Preview how Size Analysis reports highlight Android build trends. |
| 5 | +--- |
| 6 | + |
| 7 | +Size Analysis Insights point out opportunities to reduce your Android app's size. They spot patterns like duplicate files, oversized media, or unneeded assets, and list exactly what to fix along with the estimated size savings. |
| 8 | + |
| 9 | +## Android Insights |
| 10 | + |
| 11 | +Below are a list of available insights for Android builds, followed by more details about each insight: |
| 12 | + |
| 13 | +| Insight | What it flags | |
| 14 | +| --------------------------------------------------------- | --------------------------------------------------------------------- | |
| 15 | +| [Duplicate Files](#duplicate-files) | Flags identical payloads so you can drop the duplicates | |
| 16 | +| [Large Images](#large-images) | Surfaces oversized image assets worth recompressing or resizing. | |
| 17 | +| [Large Videos](#large-videos) | Highlights video files that are bigger than typical delivery budgets. | |
| 18 | +| [WebP Optimization](#webp-optimization) | Tests PNG/JPEG bitmaps to see if lossless WebP would shrink them. | |
| 19 | +| [Large Audio](#large-audio) | Surfaces hefty audio tracks that could be recompressed or trimmed. | |
| 20 | +| [Hermes Debug Info (RN Only)](#hermes-debug-info-rn-only) | Points to bundled Hermes bytecode still carrying debugger metadata. | |
| 21 | + |
| 22 | +### Duplicate Files |
| 23 | + |
| 24 | +**What it is**: Finds matching files or directories inside `assets/`, `res/`, or embedded libraries. Duplicate files are determined by examining the file hash, ensuring these are truly duplicates and not just similar files or the same file name. |
| 25 | + |
| 26 | +**How to fix**: Keep one copy and remove or dedupe the rest. For resource folders, consolidate the asset into a shared module or asset pack so the APK only bundles it once. |
| 27 | + |
| 28 | +### Large Images |
| 29 | + |
| 30 | +**What it is**: Flags image files larger than 10 MB. |
| 31 | + |
| 32 | +**How to fix**: Compress images with lossless WebP or resize them before bundling. |
| 33 | + |
| 34 | + |
| 35 | +**Options:** |
| 36 | + |
| 37 | +- Use Android Studio: right-click an image → **Convert to WebP** → select **Lossless**. |
| 38 | +- Use the command line: |
| 39 | + |
| 40 | + ```bash |
| 41 | + # Install cwebp |
| 42 | + brew install webp |
| 43 | + |
| 44 | + # Convert PNG to lossless WebP |
| 45 | + cwebp -lossless input.png -o output.webp |
| 46 | + |
| 47 | + # Convert JPEG to lossless WebP |
| 48 | + cwebp -lossless input.jpg -o output.webp |
| 49 | + ``` |
| 50 | + |
| 51 | +Large hero images or splash screens may also load more efficiently if served over the network instead of being bundled with the app. |
| 52 | + |
| 53 | +### Large Videos |
| 54 | + |
| 55 | +**What it is**: Highlights bundled video assets above 10 MB. |
| 56 | + |
| 57 | +**How to fix**: Re-encode them to H.264 or HEVC with a lower bitrate, shorten the clip, or host the video remotely and stream it on demand. To shrink a clip in place, try FFmpeg: |
| 58 | + |
| 59 | +```bash |
| 60 | +ffmpeg -i input.mp4 -c:v libx264 -crf 23 -preset slow -c:a copy output.mp4 |
| 61 | +``` |
| 62 | + |
| 63 | +Lower the `-crf` value for higher quality (and larger files), or raise it for smaller files. |
| 64 | + |
| 65 | +### WebP Optimization |
| 66 | + |
| 67 | +**What it is**: Tests every PNG, BMP, JPG, or JPEG (excluding `.9.png`) against lossless WebP conversion. If the WebP variant saves at least 500 bytes, the insight lists the asset. |
| 68 | + |
| 69 | +**How to fix**: Convert the listed bitmap to lossless WebP and update its references. Pick one of the paths below. |
| 70 | + |
| 71 | +#### Option 1: Android Studio |
| 72 | + |
| 73 | +1. In Android Studio, right-click the image. |
| 74 | +2. Choose **Convert to WebP…**. |
| 75 | +3. Select **Lossless** (API 18+ supports it) and review the preview. |
| 76 | + |
| 77 | +#### Option 2: Command line |
| 78 | + |
| 79 | +```bash |
| 80 | +# Install cwebp |
| 81 | +brew install webp |
| 82 | + |
| 83 | +# Convert PNG to lossless WebP |
| 84 | +cwebp -lossless input.png -o output.webp |
| 85 | + |
| 86 | +# Convert JPEG to lossless WebP |
| 87 | +cwebp -lossless input.jpg -o output.webp |
| 88 | +``` |
| 89 | + |
| 90 | +> Lossless WebP with alpha requires `minSdkVersion` ≥ 18. For older devices, keep PNG fallbacks for assets that rely on transparency. |
| 91 | +
|
| 92 | +### Large Audio |
| 93 | + |
| 94 | +**What it is**: Surfaces audio files larger than 5 MB across `res/raw`, `assets`, or libraries. |
| 95 | + |
| 96 | +**How to fix**: Re-encode them at a lower bitrate or modern format using FFmpeg or your DAW, trim unused segments, or stream long-form media instead of bundling it. A quick FFmpeg recompress: |
| 97 | + |
| 98 | +```bash |
| 99 | +ffmpeg -i input.wav -c:a aac -b:a 128k output.m4a |
| 100 | +``` |
| 101 | + |
| 102 | +You can tweak the bitrate (`b:a`) to balance quality vs. size. Higher bitrates (192k-256k) will be higher quality, but larger size. Lower bitrates (96k-128k) will be lower quality, but smaller size. If your audio file is voice-only, you can use a lower bitrate with little degradation in quality. Music files may benefit from a higher bitrate. |
| 103 | + |
| 104 | +### Hermes Debug Info (RN Only) |
| 105 | + |
| 106 | +**What it is**: Detects Hermes bytecode bundles that still contain debug info sections. |
| 107 | + |
| 108 | +**How to fix**: Build the React Native bundle in release mode (`react-native bundle --dev false` or the Gradle release task) so Hermes strips debug sections before packaging. |
0 commit comments