-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
(WIP) Mtopo27/size analysis docs #15256
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mtopo27
wants to merge
64
commits into
master
Choose a base branch
from
mtopo27/size-analysis-docs
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,046
−1
Open
Changes from 61 commits
Commits
Show all changes
64 commits
Select commit
Hold shift + click to select a range
defc5a6
init emerge docs
mtopo27 0a0fbaa
delete feature pages (for now)
mtopo27 a3fc8eb
throwing stuff down
mtopo27 6c472be
comments
mtopo27 e136a63
insight
mtopo27 935e91d
cross platform insights
mtopo27 84c69b6
iOS changes
trevor-e 4bb7e6f
update insights
trevor-e 87195c4
oops
trevor-e 896c120
Update to alpha.6
runningcode abde456
Incorporate comments
runningcode 633261f
big refactor to formatting
mtopo27 b74e732
add some todos
mtopo27 97371a3
Add links to authenticate
runningcode a447287
docs(size-analysis): Add best practices and vcsInfo documentation
runningcode 269f074
docs(size-analysis): Add Fastlane metadata override documentation
runningcode 589f484
noah comments
mtopo27 f5591b1
ios insights
trevor-e a7827d7
ios insights
trevor-e 5694751
ios setup
trevor-e 07faf8d
docs(size-analysis): Refine CI integration and upload docs
runningcode 9d4d068
docs(size-analysis): Improve installation steps and status check clarity
runningcode b5759eb
reword intro paragraphs on sdk pages
mtopo27 a0d62d7
alex comments
mtopo27 8ca5b1b
Apply suggestion from @coolguyzone
mtopo27 64a1819
app thinning
trevor-e 467176b
status check image
mtopo27 4d0d075
compress
mtopo27 80c7a04
add some pics, delete the insights page
mtopo27 823a889
typo
mtopo27 a833c9f
smallstrings
trevor-e 75beead
large images
trevor-e bd7ffbd
upload metadata
trevor-e ee1015c
oops
trevor-e b9a68f6
CI
trevor-e 5485800
rebasing
mtopo27 9a42ad1
compress images
mtopo27 1db4298
ci
trevor-e 1244081
remove some todos
mtopo27 df9ee14
ci
trevor-e 6a331fd
nit
trevor-e 992f405
what's next
trevor-e 31d9785
rework minify insight
mtopo27 fa0ed6c
debug symbol image
mtopo27 6cedc29
remove crashlytics reference
mtopo27 97cf608
small copy
mtopo27 f0559e1
Merge branch 'master' into mtopo27/size-analysis-docs
mtopo27 e0f91ce
Merge branch 'master' into mtopo27/size-analysis-docs
mtopo27 b91ef9b
duplicate file android copy
mtopo27 161c795
Apply suggestions from code review
mtopo27 c12af86
match up script
mtopo27 cd9a844
remove todo
mtopo27 bcab471
removing some todos
mtopo27 653bca6
app store connect + thinning
trevor-e 68bfd75
bitrate
mtopo27 3da246e
final todo
mtopo27 ba378f7
update image scripts
NicoHinderling 691e7b9
update the dsyms input file value
NicoHinderling 579ca3a
lints
NicoHinderling 5b84ef2
Apply suggestions from code review
mtopo27 c0432b7
more image info
NicoHinderling e180436
CI permissions
trevor-e 838e5f3
Apply suggestions from code review
mtopo27 ff1a6ad
Merge branch 'master' into mtopo27/size-analysis-docs
mtopo27 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| --- | ||
| title: Size Analysis | ||
| sidebar_title: Size Analysis | ||
| sidebar_order: 5200 | ||
| description: Upload Android builds to Sentry for Size Analysis. | ||
| --- | ||
|
|
||
| <Include name="size-analysis/ea" /> | ||
|
|
||
| [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. | ||
|
|
||
| ## Getting Started | ||
|
|
||
| **Accepted Formats**: AAB (preferred) | APK | ||
|
|
||
| **Upload Mechanisms**: [Gradle](#uploading-with-gradle) | [Sentry CLI](#uploading-with-the-sentry-cli) | ||
|
|
||
| ### Uploading With Gradle | ||
|
|
||
| <Include name="size-analysis/upload-gradle" /> | ||
|
|
||
| ### Uploading With the Sentry CLI | ||
|
|
||
| <Include name="size-analysis/upload-cli-android" /> | ||
|
|
||
| ## Upload Metadata | ||
|
|
||
| <Include name="size-analysis/upload-metadata" /> | ||
|
|
||
| ### Build Configuration | ||
|
|
||
| <Include name="size-analysis/build-configuration-android" /> | ||
|
|
||
| ## What's Next? | ||
|
|
||
| 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/). | ||
|
|
||
| <PageGrid /> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,108 @@ | ||
| --- | ||
| title: Insights | ||
| sidebar_order: 5250 | ||
| description: Preview how Size Analysis reports highlight Android build trends. | ||
| --- | ||
|
|
||
| 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. | ||
|
|
||
| ## Android Insights | ||
|
|
||
| Below are a list of available insights for Android builds, followed by more details about each insight: | ||
|
|
||
| | Insight | What it flags | | ||
| | --------------------------------------------------------- | --------------------------------------------------------------------- | | ||
| | [Duplicate Files](#duplicate-files) | Flags identical payloads so you can drop the duplicates | | ||
| | [Large Images](#large-images) | Surfaces oversized image assets worth recompressing or resizing. | | ||
| | [Large Videos](#large-videos) | Highlights video files that are bigger than typical delivery budgets. | | ||
| | [WebP Optimization](#webp-optimization) | Tests PNG/JPEG bitmaps to see if lossless WebP would shrink them. | | ||
| | [Large Audio](#large-audio) | Surfaces hefty audio tracks that could be recompressed or trimmed. | | ||
| | [Hermes Debug Info (RN Only)](#hermes-debug-info-rn-only) | Points to bundled Hermes bytecode still carrying debugger metadata. | | ||
|
|
||
| ### Duplicate Files | ||
mtopo27 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| **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. | ||
|
|
||
| **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. | ||
|
|
||
| ### Large Images | ||
|
|
||
| **What it is**: Flags image files larger than 10 MB. | ||
|
|
||
| **How to fix**: Compress images with lossless WebP or resize them before bundling. | ||
|
|
||
|
|
||
| **Options:** | ||
|
|
||
| - Use Android Studio: right-click an image → **Convert to WebP** → select **Lossless**. | ||
| - Use the command line: | ||
|
|
||
| ```bash | ||
| # Install cwebp | ||
| brew install webp | ||
|
|
||
| # Convert PNG to lossless WebP | ||
| cwebp -lossless input.png -o output.webp | ||
|
|
||
| # Convert JPEG to lossless WebP | ||
| cwebp -lossless input.jpg -o output.webp | ||
| ``` | ||
|
|
||
| Large hero images or splash screens may also load more efficiently if served over the network instead of being bundled with the app. | ||
|
|
||
| ### Large Videos | ||
|
|
||
| **What it is**: Highlights bundled video assets above 10 MB. | ||
|
|
||
| **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: | ||
|
|
||
| ```bash | ||
| ffmpeg -i input.mp4 -c:v libx264 -crf 23 -preset slow -c:a copy output.mp4 | ||
| ``` | ||
|
|
||
| Lower the `-crf` value for higher quality (and larger files), or raise it for smaller files. | ||
|
|
||
| ### WebP Optimization | ||
|
|
||
| **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. | ||
|
|
||
| **How to fix**: Convert the listed bitmap to lossless WebP and update its references. Pick one of the paths below. | ||
|
|
||
| #### Option 1: Android Studio | ||
|
|
||
| 1. In Android Studio, right-click the image. | ||
| 2. Choose **Convert to WebP…**. | ||
| 3. Select **Lossless** (API 18+ supports it) and review the preview. | ||
|
|
||
| #### Option 2: Command line | ||
|
|
||
| ```bash | ||
| # Install cwebp | ||
| brew install webp | ||
|
|
||
| # Convert PNG to lossless WebP | ||
| cwebp -lossless input.png -o output.webp | ||
|
|
||
| # Convert JPEG to lossless WebP | ||
| cwebp -lossless input.jpg -o output.webp | ||
| ``` | ||
|
|
||
| > Lossless WebP with alpha requires `minSdkVersion` ≥ 18. For older devices, keep PNG fallbacks for assets that rely on transparency. | ||
|
|
||
| ### Large Audio | ||
|
|
||
| **What it is**: Surfaces audio files larger than 5 MB across `res/raw`, `assets`, or libraries. | ||
|
|
||
| **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: | ||
|
|
||
| ```bash | ||
| ffmpeg -i input.wav -c:a aac -b:a 128k output.m4a | ||
| ``` | ||
|
|
||
| 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. | ||
|
|
||
| ### Hermes Debug Info (RN Only) | ||
|
|
||
| **What it is**: Detects Hermes bytecode bundles that still contain debug info sections. | ||
|
|
||
| **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. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+11.9 KB
docs/platforms/apple/guides/ios/size-analysis/images/exported-symbols.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+99.8 KB
docs/platforms/apple/guides/ios/size-analysis/images/strip-symbols.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| --- | ||
| title: Size Analysis | ||
| sidebar_order: 5200 | ||
| description: Upload iOS builds to Sentry for size analysis. | ||
| --- | ||
|
|
||
| <Include name="size-analysis/ea" /> | ||
|
|
||
| [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. | ||
|
|
||
| ## Getting Started | ||
|
|
||
| **Accepted Formats**: XCArchive (preferred) | IPA | ||
mtopo27 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| **Upload Mechanisms**: [Fastlane Plugin](#uploading-with-fastlane) (version 1.34.0 or higher) *or* [Sentry CLI](#uploading-with-the-sentry-cli) | ||
|
|
||
| ### Uploading With Fastlane | ||
|
|
||
| <Include name="size-analysis/upload-fastlane" /> | ||
|
|
||
| ### Uploading with the Sentry CLI | ||
|
|
||
| <Include name="size-analysis/upload-cli-ios" /> | ||
|
|
||
| ## Upload Metadata | ||
|
|
||
| <Include name="size-analysis/upload-metadata" /> | ||
|
|
||
| ### Build Configuration | ||
|
|
||
| <Include name="size-analysis/build-configuration-ios" /> | ||
|
|
||
| ## Understanding App Size | ||
|
|
||
| ### What We're Measuring | ||
|
|
||
| <Include name="size-analysis/what-were-measuring" /> | ||
|
|
||
| ### App Thinning | ||
|
|
||
| <Include name="size-analysis/app-thinning" /> | ||
|
|
||
| ### App Store Connect File Sizes | ||
|
|
||
| <Include name="size-analysis/app-store-connect-file-sizes" /> | ||
|
|
||
| ## What's Next? | ||
|
|
||
| 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/). | ||
|
|
||
| <PageGrid /> | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.