Skip to content

Commit e76bb9c

Browse files
mtopo27trevor-erunningcodeclaudecoolguyzone
authored
(WIP) Mtopo27/size analysis docs (#15256)
<!-- Use this checklist to make sure your PR is ready for merge. You may delete any sections you don't need. --> ## DESCRIBE YOUR PR adding docs for Size Analysis funcitonality ## IS YOUR CHANGE URGENT? Help us prioritize incoming PRs by letting us know when the change needs to go live. - [ ] Urgent deadline (GA date, etc.): <!-- ENTER DATE HERE --> - [x] Other deadline: Targeting week of 11/3 - [ ] None: Not urgent, can wait up to 1 week+ ## SLA - Teamwork makes the dream work, so please add a reviewer to your PRs. - Please give the docs team up to 1 week to review your PR unless you've added an urgent due date to it. Thanks in advance for your help! ## PRE-MERGE CHECKLIST *Make sure you've checked the following before merging your changes:* - [x] Checked Vercel preview for correctness, including links - [ ] PR was reviewed and approved by any necessary SMEs (subject matter experts) - [ ] PR was reviewed and approved by a member of the [Sentry docs team](https://github.com/orgs/getsentry/teams/docs) ## LEGAL BOILERPLATE <!-- Sentry employees and contractors can delete or ignore this section. --> Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms. ## EXTRA RESOURCES - [Sentry Docs contributor guide](https://docs.sentry.io/contributing/) --------- Co-authored-by: Trevor Elkins <[email protected]> Co-authored-by: Nelson Osacky <[email protected]> Co-authored-by: Claude <[email protected]> Co-authored-by: Alex Krawiec <[email protected]> Co-authored-by: Nico Hinderling <[email protected]>
1 parent c0d6f87 commit e76bb9c

File tree

33 files changed

+1021
-1
lines changed

33 files changed

+1021
-1
lines changed

docs/organization/early-adopter-features/index.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,4 @@ Limitations:
2323
- [Span Summary](/product/insights/overview/transaction-summary/#span-summary)
2424
- [Dynamic Alerts](/product/alerts/create-alerts/metric-alert-config/#dynamic-alerts)
2525
- [New Trace Explorer With Span Metrics](/product/explore/new-trace-explorer/)
26+
- [Size Analysis](/product/size-analysis/)
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
title: Size Analysis
3+
sidebar_title: Size Analysis
4+
sidebar_order: 5200
5+
description: Upload Android builds to Sentry for Size Analysis.
6+
---
7+
8+
<Include name="size-analysis/ea" />
9+
10+
[Size Analysis](/product/size-analysis) helps monitor your mobile app's size in pre-production to prevent unexpected size increases (regressions) from reaching users. Aside from being courteous to your users, a smaller app size helps boost installation and retention rates, especially for customers with limited storage or slower connections.
11+
12+
## Getting Started
13+
14+
**Accepted Formats**: AAB (preferred) | APK
15+
16+
**Upload Mechanisms**: [Gradle](#uploading-with-gradle) | [Sentry CLI](#uploading-with-the-sentry-cli)
17+
18+
### Uploading With Gradle
19+
20+
<Include name="size-analysis/upload-gradle" />
21+
22+
### Uploading With the Sentry CLI
23+
24+
<Include name="size-analysis/upload-cli-android" />
25+
26+
## Upload Metadata
27+
28+
<Include name="size-analysis/upload-metadata" />
29+
30+
### Build Configuration
31+
32+
<Include name="size-analysis/build-configuration-android" />
33+
34+
## What's Next?
35+
36+
We strongly recommend integrating Size Analysis into your CI pipeline. Follow our guide on [getting set up in CI](/product/size-analysis/integrating-into-ci/).
37+
38+
<PageGrid />
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
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.
11.9 KB
Loading
99.8 KB
Loading
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
---
2+
title: Size Analysis
3+
sidebar_order: 5200
4+
description: Upload iOS builds to Sentry for size analysis.
5+
---
6+
7+
<Include name="size-analysis/ea" />
8+
9+
[Size Analysis](/product/size-analysis) helps monitor your mobile app's size in pre-production to prevent unexpected size increases (regressions) from reaching users. Aside from being courteous to your users, a smaller app size helps boost installation and retention rates, especially for customers with limited storage or slower connections.
10+
11+
## Getting Started
12+
13+
**Accepted Formats**: XCArchive (preferred) | IPA
14+
15+
**Upload Mechanisms**: [Fastlane Plugin](#uploading-with-fastlane) (version 1.34.0 or higher) _or_ [Sentry CLI](#uploading-with-the-sentry-cli)
16+
17+
### Uploading With Fastlane
18+
19+
<Include name="size-analysis/upload-fastlane" />
20+
21+
### Uploading with the Sentry CLI
22+
23+
<Include name="size-analysis/upload-cli-ios" />
24+
25+
## Upload Metadata
26+
27+
<Include name="size-analysis/upload-metadata" />
28+
29+
### Build Configuration
30+
31+
<Include name="size-analysis/build-configuration-ios" />
32+
33+
## Understanding App Size
34+
35+
### App Thinning
36+
37+
<Include name="size-analysis/app-thinning" />
38+
39+
### App Store Connect File Sizes
40+
41+
<Include name="size-analysis/app-store-connect-file-sizes" />
42+
43+
## What's Next?
44+
45+
We strongly recommend integrating Size Analysis into your CI pipeline. Follow our guide on [getting set up in CI](/product/size-analysis/integrating-into-ci/).
46+
47+
<PageGrid />

0 commit comments

Comments
 (0)