Repository navigation
ADFA-6822: pin R8 8.13.25 so D8 can rewrite Kotlin 2.3 metadata - #2209
Merged
Merged
Conversation
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.
Tip: disable this comment in your organization's Code Review settings.
Contributor
Daniel-ADFA
approved these changes
Oct 29, 2026
AGP 8.8.2 bundles D8 8.8.34, which predates Kotlin 2.3 metadata (mv 2.3.0) and throws "Should never be called" while rewriting it. D8 logged this once per class: 25,416 times, ~2.3M lines, in a local assembleV8Debug. Put com.android.tools:r8 first on the root buildscript classpath so it wins over the R8 shaded inside AGP's builder jar. A temporary probe confirmed the version in use changed from 8.8.34 to 8.13.25. Add a CI guard after the assemble step that fails if the warning reappears, so a Kotlin bump cannot silently bring it back. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAYXNkCD7buZPP5ZbJP
* Drop the root buildscript `repositories { google() }`: r8 resolves without
it (checked with `buildEnvironment`), so it was a redundant third place to
configure repositories.
* Move the rationale next to the `r8` catalog entry; leave a short pointer
next to `kotlin`.
* Make the CI guard's error message not assume the pin is merely too old: the
pin may also have stopped taking effect on the build classpath.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vh2DAYXNkCD7buZPP5ZbJP
davidschachterADFA
force-pushed
the
fix/ADFA-6822-d8-kotlin-metadata
branch
from
October 30, 2026 18:10
e5d0b9f to
93d3061
Compare
The note sat below `kotlin`, directly above `kotlin-coroutines`, so it read as being about coroutines. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAYjFcUx64N8PMRknzL
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
ADFA-6822: D8 "Unexpected error during rewriting of Kotlin metadata"
AGP 8.8.2 bundles D8 8.8.34, which predates Kotlin 2.3 metadata (
mv=[2,3,0]) and throwsShould never be calledwhile rewriting it. D8 logged this once per class, burying every real diagnostic in the CI log.This PR puts
com.android.tools:r8:8.13.25first on the root buildscript classpath so it wins over the R8 shaded in AGP's builder jar, and adds a CI guard so a Kotlin bump can't silently bring the problem back. Dropping the pin needs an AGP upgrade, tracked separately.Changes
gradle/libs.versions.toml:r8 = "8.13.25"andandroid-r8, plus a comment next tokotlinthat a Kotlin minor bump may need a newerr8.build.gradle.kts:classpath(libs.android.r8)first in the rootbuildscript. It resolves from the repositories the build already declares, so thebuildscripthas norepositoriesblock of its own..github/workflows/debug.yml: the Assemble step now tees the Gradle output and fails with an::error::if it containsUnexpected error during rewriting of Kotlin metadata.Results (local
:app:clean :app:assembleV8Debug --no-build-cache)NoSuchMethodError/NoClassDefFoundErrorAn earlier baseline run counted 25,416; the ticket's 2,743 came from the CI log and undercounts.
Verified
:app:assembleV8Release,assembleV8Profileable,assembleV7Debug,:app:testV8DebugUnitTestandspotlessCheckall pass (BUILD SUCCESSFUL in 14m 14s, 0 metadata warnings).FATAL EXCEPTIONin logcat.Not verified
dexdumpdoesn't show annotation values; theLkotlin/Metadata;reference counts match before and after (207), and runtime impact was probably nil to begin with (kotlin-reflectis not on:app's runtime classpath).Notes
2>&1 | tee). ADFA-6818, which merges the Gradle invocations, will need to preserve it.agp-tooling9.3.1) is untouched.classpathline and the catalog entry.🤖 Generated with Claude Code
https://claude.ai/code/session_01Vh2DAYXNkCD7buZPP5ZbJP