Skip to content

Build with non-final resource ids - #96

Merged
jgindin merged 3 commits into
mainfrom
agp-non-final-res-ids
Nov 26, 2026
Merged

jgindin merged 3 commits into
mainfrom
agp-non-final-res-ids

Conversation

@jgindin

@jgindin jgindin commented Nov 26, 2026 •

Copy link
Copy Markdown
Owner

Builds both apps with non-final resource ids by removing android.nonFinalResIds=false and android.enableAppCompileTimeRClass=false, which AGP 9 deprecates and AGP 10 removes.

  • First commit: the four switch statements on resource ids become if/else chains with the same outcomes. These are three in ZmanimActivity (menu items, then creating and preparing the message dialogs) and one in ZehutYosefActivity (drawer items). A case label must be a constant, and non-final ids aren't. ZmanimActivity checks the privacy, about and help ids in one place.
  • Second commit: keeps, in each app's test-only R8 rules, the R fields its on-device tests look up. With non-final ids the tests read those fields at run time, but R8 inlines the ids into the app's own code and drops the R classes that the releaseCheck test APK shares with the app. Each kept field names a resource the app already uses, so releaseCheck keeps no resource that the release build leaves out.
  • Third commit: removes the two options.

In the release APKs only the dex files and baseline profiles change, by a few bytes. Every resource is the same.

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.

🤖 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-new-dsl branch 2 times, most recently from a86616a to ae6f143 Compare November 26, 2026 19:56
@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-non-final-res-ids branch from 3c9dcbd to acb87f0 Compare November 26, 2026 20:09
jgindin and others added 3 commits November 26, 2026 15:21
…ead of switching on them.

A switch needs constant case labels, and with AGP's non-final resource ids the ids are not constants. The three switches in ZmanimActivity and the one in ZehutYosefActivity become if/else chains with the same outcomes; the privacy, about and help ids are checked in one place.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…releaseCheck builds.

With non-final resource ids the tests read the app's R fields at run time, but R8 inlines the ids into the app's own code and drops the R classes, which the test APK shares with the app, so the tests could not find R$id or R$string. The rules keep only the fields the tests read, each naming a resource the app itself uses, so the minified build keeps no resource the release build leaves out.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ResIds=false and android.enableAppCompileTimeRClass=false.

AGP warns that both options go away in AGP 10. With them gone, the app modules compile against a compile-time R class whose ids are not constants, as library modules do; no code switches on a resource id any more. In the release APKs only the dex files and baseline profiles change, by a few bytes; every resource is the same.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Base automatically changed from agp-new-dsl to main November 26, 2026 20:21
@jgindin
jgindin force-pushed the agp-non-final-res-ids branch from acb87f0 to f2d3d0d Compare November 26, 2026 20:21
@jgindin
jgindin merged commit 659cdfc into main Nov 26, 2026
8 checks passed
@jgindin
jgindin deleted the agp-non-final-res-ids branch November 26, 2026 20:33
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