-
-
Notifications
You must be signed in to change notification settings - Fork 34
ADFA-3771: Document android-sdk.zip image recompression procedure #1602
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
Merged
davidschachterADFA
merged 6 commits into
stage
from
chore/ADFA-3771-recompress-wallpaper-images
Jul 30, 2026
+73
−0
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
b37bb2b
ADFA-3771: Document android-sdk.zip image recompression procedure
davidschachterADFA 9848996
ADFA-3771: Add sh language identifier to fenced code blocks
davidschachterADFA 84c2592
ADFA-3771: Fix relative zip path after cd work
davidschachterADFA 026e37f
ADFA-3771: Verify both zips, not just arm64-v8a
davidschachterADFA d7a7ff8
ADFA-3771: Fix dangling memory-note reference and hardcoded platform …
davidschachterADFA 1dbc987
Merge branch 'stage' into chore/ADFA-3771-recompress-wallpaper-images
davidschachterADFA 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| # Recompressing oversized images in android-sdk.zip | ||
|
|
||
| `android-sdk-arm64-v8a.zip` / `android-sdk-armeabi-v7a.zip` are downloaded assets | ||
| (see `debugAssets`/`releaseAssets` in `app/build.gradle.kts`), not built in this | ||
| repo — they're a packaged copy of Android SDK platform data (`platforms/android-<N>/`) | ||
| fetched from appdevforall.org. Some of the bundled platform resources are large, | ||
| unoptimized PNGs that bloat the APK for no benefit (ADFA-3771 found two default | ||
| wallpaper images at ~2.7MB and ~3.9MB). | ||
|
|
||
| ## Finding an oversized asset | ||
|
|
||
| ```sh | ||
| unzip -l assets/android-sdk-arm64-v8a.zip | sort -n -k1 | tail -20 | ||
| ``` | ||
|
|
||
| ## Recompressing | ||
|
|
||
| Lossless recompression (`zopflipng`) barely helps here — these PNGs are already | ||
| well DEFLATE-compressed, and re-running DEFLATE on the same pixel data doesn't | ||
| buy much. The real win is `pngquant`'s palette quantization, which is lossy but | ||
| usually visually indistinguishable at these quality settings for | ||
| photographic/gradient content like a wallpaper: | ||
|
|
||
| ```sh | ||
| pngquant --quality=80-95 --strip --force --output out.png in.png | ||
| ``` | ||
|
|
||
| **`pngquant` on this machine is a snap package** and can't read files outside | ||
| its allowed roots — a path like `/tmp/.../scratchpad/foo.png` fails with | ||
| `cannot open ... for reading` even though the file exists and is readable by | ||
| the same user. Snap confinement only grants read/write access under `$HOME`, | ||
| `/media`, and a few other allowed roots, so copy the input into `$HOME` first | ||
| (the same workaround applies to other snap-packaged CLI tools, e.g. `jira-cli`). | ||
| Confirmed savings for | ||
| ADFA-3771: `drawable-sw600dp-nodpi/default_wallpaper.png` 2.75MB → 844KB (69%), | ||
| `drawable-sw720dp-nodpi/default_wallpaper.png` 3.94MB → 1.43MB (64%). | ||
|
|
||
| Always visually diff before/after (open both images) — quantization quality | ||
| varies a lot by image content, and this doesn't have a UI test to catch a bad | ||
| result. | ||
|
|
||
| ## Updating the zip in place | ||
|
|
||
| `zip` can replace a single entry in an existing archive without rewriting the | ||
| whole thing, as long as the working directory mirrors the archive's internal | ||
| path structure. Substitute `android-<N>` below with whichever platform | ||
| directory (from `unzip -l`) actually contains the target asset — it's | ||
| `android-36` for ADFA-3771's SDK level, but will differ for other assets or | ||
| future SDK bumps: | ||
|
|
||
| ```sh | ||
| mkdir -p work/platforms/android-<N>/data/res/drawable-sw600dp-nodpi | ||
| cp out.png work/platforms/android-<N>/data/res/drawable-sw600dp-nodpi/default_wallpaper.png | ||
| cd work | ||
| zip ../assets/android-sdk-arm64-v8a.zip platforms/android-<N>/data/res/drawable-sw600dp-nodpi/default_wallpaper.png | ||
| ``` | ||
|
|
||
| Repeat for `android-sdk-armeabi-v7a.zip` — SDK platform resources are | ||
| architecture-independent, so both zips carry byte-identical copies of these | ||
| files (verified via `md5sum` before touching either). Verify afterward: | ||
|
|
||
| ```sh | ||
| unzip -t assets/android-sdk-arm64-v8a.zip # "No errors detected" | ||
| unzip -t assets/android-sdk-armeabi-v7a.zip # "No errors detected" | ||
| ``` | ||
|
|
||
| ## Scope | ||
|
|
||
| This only rewrites the locally downloaded copies under `assets/` (gitignored — | ||
| see `assetsDownloadDebug`/`assetsDownloadRelease` in `app/build.gradle.kts`). | ||
| Getting the recompressed images into the real, published `android-sdk.zip` / | ||
| `android-sdk.zip.br` on appdevforall.org is a separate, external publishing | ||
| step outside this repo. | ||
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.