Skip to content

Use R8's optimized resource shrinking - #97

Merged
jgindin merged 1 commit into
mainfrom
agp-optimized-resource-shrinking
Nov 26, 2026
Merged

jgindin merged 1 commit into
mainfrom
agp-optimized-resource-shrinking

Conversation

@jgindin

@jgindin jgindin commented Nov 26, 2026 •

Copy link
Copy Markdown
Owner

Turns on R8's optimized resource shrinking by removing android.r8.optimizedResourceShrinking=false, which AGP 9 deprecates and AGP 10 removes.

What ships

  • R8 now decides which resources to keep from the code it keeps. That leaves out resources referenced only by unused library code (mostly Material and AppCompat widgets the apps don't use).
  • The Zmanim release APK is about 112 KB smaller, and each Zehut Yosef APK about 12 KB smaller.
  • AboutLibraries looks up its strings by name, and keep.xml still keeps them.

checkR8KeptNames

  • R8 writes its resource log in its own format: one line per resource, with removed ones ending in "is not reachable.". The check now reads that format.
  • Mutation-checked: with the library_* keep removed from keep.xml, the check fails and names the removed strings.

Checked on an API 36 emulator

  • All releaseCheck on-device tests pass: Zmanim's 15, its offline-naming test with the network off, and 4 per Zehut Yosef flavor.
  • The minified release APKs were installed and walked by hand with no crash or missing resource in logcat:
    • Zmanim's main screen, Preferences (including the notification sound picker), Location settings, the zman choice dialog, and Feedback, Privacy Policy, About and Help;
    • Zehut Yosef's reader, Settings and font picker.

🤖 Generated with Claude Code

@jgindin
jgindin force-pushed the agp-non-final-res-ids branch from 8613c42 to f3b398f Compare November 26, 2026 19:38
@jgindin
jgindin force-pushed the agp-optimized-resource-shrinking branch from 675c35d to f61d593 Compare November 26, 2026 19:38
@jgindin
jgindin force-pushed the agp-non-final-res-ids branch from f3b398f to 3c9dcbd Compare November 26, 2026 19:56
@jgindin
jgindin force-pushed the agp-optimized-resource-shrinking branch 2 times, most recently from a4e1d73 to c190179 Compare November 26, 2026 20:09
@jgindin
jgindin force-pushed the agp-non-final-res-ids branch 2 times, most recently from acb87f0 to f2d3d0d Compare November 26, 2026 20:21
@jgindin
jgindin force-pushed the agp-optimized-resource-shrinking branch from c190179 to d0632e3 Compare November 26, 2026 20:21
Base automatically changed from agp-non-final-res-ids to main November 26, 2026 20:33
…roid.r8.optimizedResourceShrinking=false.

AGP warns that the option goes away in AGP 10. R8 now decides which resources ship from the code it keeps, so resources only unused library code referred to (mostly Material and AppCompat widgets the apps do not use) are left out, along with the R classes. The Zmanim release APK is about 112 KB smaller and each Zehut Yosef APK about 12 KB smaller. AboutLibraries' strings, which it looks up by name, stay kept by ZehutYosef's keep.xml.

R8 writes its resource log in its own format, a line per resource ending in "is not reachable." for those it removed, so checkR8KeptNames reads that format.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jgindin
jgindin force-pushed the agp-optimized-resource-shrinking branch from d0632e3 to 8dd3210 Compare November 26, 2026 20:33
@jgindin
jgindin merged commit 46fb950 into main Nov 26, 2026
10 of 12 checks passed
@jgindin
jgindin deleted the agp-optimized-resource-shrinking branch November 26, 2026 20:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant