Repository navigation
fix(build): bump AGP 8.9.1 -> 8.13.2, Gradle 8.11.1 -> 8.13 (#582) - #672
Conversation
R8 bundled with AGP 8.9.1 (~8.9.x) predates the metadata-format Kotlin 2.2 started emitting, and chokes deterministically on certain Kotlin metadata shapes (e.g. core:vaultcontent's VaultDataSource$Factory) during androidTest dexing — 'D8: Unexpected error during rewriting of Kotlin metadata ... Should never be called', repeated once per affected class until CircleCI's 50MB step-output cap kills the job. All 25 actual test cases in that CircleCI run passed; this was purely a build-tooling incompatibility, never a real test failure. Root-caused and documented in #582 already; this is the fix. Per Google's AGP/D8/R8 <-> Kotlin compatibility table, Kotlin 2.2 needs R8 >=8.10.21. AGP 8.13.2 bundles R8 8.13.19 — comfortably clears that bar, and critically is still on the 8.x line: AGP 9.x would force Hilt 2.58 -> 2.59+ (2.58 is deliberately the last pre-AGP-9-required Hilt release, per the 08-12 toolchain-bump PR #103's own reasoning), which needs its own separate Kotlin-2.2/KSP2 compatibility pass rather than riding along with this fix. Three places updated together, per #582's own note that these are hardcoded duplicates, not catalog-derived (build-logic/convention can't see the root version catalog): - gradle/libs.versions.toml (agp) - build-logic/convention/build.gradle.kts (compileOnly com.android.tools.build:gradle) - gradle/wrapper/gradle-wrapper.properties (+ gradlew/gradlew.bat/gradle-wrapper.jar, regenerated via ./gradlew wrapper --gradle-version 8.13 --distribution-type bin — AGP 8.13.2's stated minimum/default Gradle version) hilt/room/kotlin/ksp/compose-bom pins untouched deliberately — staying under AGP 9 means none of them need to move. Verified, not assumed: - :app:assembleFdroidDebug — builds clean under the new AGP/Gradle, including app/build.gradle.kts's legacy applicationVariants/BaseVariantOutputImpl API usage (a real risk for an AGP bump — that internal API has been deprecated for several majors and this confirms it's still present in 8.13.2). - :app:assembleFdroidDebugAndroidTest + :core:vaultcontent:assembleDebugAndroidTest — forces the exact DexingNoClasspathTransform step that failed in #582's CircleCI run. Zero 'D8:'/'Should never be called' output across the full log (previously: 10,751 repeated stack-trace lines before the 50MB cap hit). - Full JVM unit test suite (testDebugUnitTest + both flavors) — clean, no regressions from the toolchain bump itself. Not verified here (needs the CircleCI ui-tests job for real confirmation, since this repo has no local emulator/KVM): actual connectedAndroidTest execution on a real device/emulator. The dexing step failing was always the full blocker per #582's own evidence (all 25 real test cases already passed in that run) — this fix targets that specific step and confirms it clean, but the end-to-end emulator run is the next real signal. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
This PR was opened outside the automated pipeline (author isn't |
📱 iOS Build Status: PASSED⏭️ iOS Simulator Build & Unit Tests - skipped iOS UI tests run in a separate, informational job and are not reflected above — check "iOS UI Tests (informational)" for those. |
|
Triggered the CircleCI fallback pipeline for this branch (jvm-tests, ui-tests, keystore-hardware-test, tts-audio-test): https://app.circleci.com/pipelines/circleci/Vb3shupZ6E5XfRdygUxpfN/TirA73zRKDRhUGkRDEWJcd/511 |
|
Triggered the CircleCI fallback pipeline for this branch (jvm-tests, ui-tests, keystore-hardware-test, tts-audio-test): https://app.circleci.com/pipelines/circleci/Vb3shupZ6E5XfRdygUxpfN/TirA73zRKDRhUGkRDEWJcd/515 |
QA verification — PR #672 vs issue #582Issue #582 is a bug report (D8/R8 metadata-parsing crash hangs androidTest dexing under Kotlin 2.2.10 + AGP 8.9.1), so the checklist is: the repro no longer reproduces, and there's a regression signal proving it. Repro check — PASSRan the exact failing step from #582's CircleCI evidence myself, on this branch:
Real test suite — PASS
Diff verification — PASS
AGENTS.md conventions — PASS
Not independently verifiedReal Note for whoever handles merge (not a QA blocker)Issue #582 currently has two open PRs: #592 (AGP → 8.10.1, already QA verdict: PASS |
Principal review — verdict:
|
…e:player Real, previously-latent failure surfaced by #582's AGP bump: with AGP 8.9.1, checkDebugAndroidTestAarMetadata never actually ran to completion for these two modules before something else (usually the D8/R8-vs-Kotlin-2.2 metadata bug this whole fix targets) killed the build first. With that fixed, this check ran for real and failed on a genuinely pre-existing gap: Dependency ':core:vaultcontent' requires core library desugaring to be enabled for :feature:player. Dependency 'org.readium.kotlin-toolkit:readium-shared:...' requires core library desugaring to be enabled for :feature:library. feature:player depends on core:vaultcontent directly (#493's VaultAwareMediaSourceFactory); feature:library depends on it transitively via feature:player. Neither module declares its own androidTest sources, which is exactly why this never surfaced through normal unit-test runs — it's an androidTest variant classpath check, independent of whether the module has test code of its own. This is the same root cause core:vaultcontent's own build.gradle.kts already documents fixing under issue #253, just one (feature:player) and two (feature:library) dependency hops further out — same fix, same pattern: compileOptions.isCoreLibraryDesugaringEnabled + coreLibraryDesugaring(libs.desugar.jdk.libs). Verified: feature:library:checkDebugAndroidTestAarMetadata and feature:player:checkDebugAndroidTestAarMetadata both pass now (were the exact two failures in PR #672's first real CircleCI ui-tests run -- jvm-tests/keystore-hardware-test/tts-audio-test all passed, and other modules' connectedDebugAndroidTest genuinely ran real tests to completion on-device, confirming the core R8/Kotlin-metadata fix works; only these two AAR-metadata checks failed). Also re-ran the full JVM unit test suite (all flavors) and app:assembleFdroidDebugAndroidTest + core:vaultcontent's androidTest assembly clean. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
Triggered the CircleCI fallback pipeline for this branch (jvm-tests, ui-tests, keystore-hardware-test, tts-audio-test): https://app.circleci.com/pipelines/circleci/Vb3shupZ6E5XfRdygUxpfN/TirA73zRKDRhUGkRDEWJcd/519 |
📱 iOS Build Status: PASSED⏭️ iOS Simulator Build & Unit Tests - skipped iOS UI tests run in a separate, informational job and are not reflected above — check "iOS UI Tests (informational)" for those. |
|
Triggered the CircleCI fallback pipeline for this branch (jvm-tests, ui-tests, keystore-hardware-test, tts-audio-test): https://app.circleci.com/pipelines/circleci/Vb3shupZ6E5XfRdygUxpfN/TirA73zRKDRhUGkRDEWJcd/526 |
Blanket connectedDebugAndroidTest fans out across every module in the build against one shared emulator, including ~12 with zero androidTest sources that each still pay a full install/uninstall round-trip. This was masked until now by #582 failing the build earlier in the task graph; now that #582 is fixed, ui-tests reaches the full chain for the first time and hangs indefinitely (10min no-output timeout) on the last module in the sequence, 2/2 reproducible - consistent with cumulative ADB/emulator degradation, not a real test hang (the module it dies on has no androidTest sources at all). Scoped both the CircleCI job and its GH Actions mirror to the 3 modules that actually have androidTest sources: core:tts, core:vaultstore, feature:reader. Same silent-skip trap as :app's flavor-dimensioned connectedDebugAndroidTest already documented in both files - a future module gaining androidTest sources needs adding to this explicit list too. Filed as #678, fixed directly since it blocks this PR's own required ui-tests check.
|
Triggered the CircleCI fallback pipeline for this branch (jvm-tests, ui-tests, keystore-hardware-test, tts-audio-test): https://app.circleci.com/pipelines/circleci/Vb3shupZ6E5XfRdygUxpfN/TirA73zRKDRhUGkRDEWJcd/530 |
📱 iOS Build Status: PASSED⏭️ iOS Simulator Build & Unit Tests - skipped iOS UI tests run in a separate, informational job and are not reflected above — check "iOS UI Tests (informational)" for those. |
Run Lint is the job's last step, ~20 modules of lintAnalyzeDebug. On this PR the Gradle 8.13/AGP 8.13.2 bump missed setup-gradle's cache key on its first run (new wrapper distribution, invalidated lint model caches), so Run JVM tests alone took ~12m38s of the 15min budget - the job-level timeout killed Run Lint 3 modules in, still steadily progressing, not hung. Real headroom rather than tolerating a hang. Should self-resolve once dev's cache is warm again post-merge, but the extra budget is low-risk either way.
|
Triggered the CircleCI fallback pipeline for this branch (jvm-tests, ui-tests, keystore-hardware-test, tts-audio-test): https://app.circleci.com/pipelines/circleci/Vb3shupZ6E5XfRdygUxpfN/TirA73zRKDRhUGkRDEWJcd/532 |
📱 iOS Build Status: PASSED⏭️ iOS Simulator Build & Unit Tests - skipped iOS UI tests run in a separate, informational job and are not reflected above — check "iOS UI Tests (informational)" for those. |
Closes #582.
R8 bundled with AGP 8.9.1 is too old for Kotlin 2.2.10's metadata format (Google's own AGP/D8/R8 <-> Kotlin compat table requires R8 >=8.10.21 for Kotlin 2.2) — deterministically hangs androidTest dexing, as #582 already root-caused with real CircleCI evidence (all 25 actual test cases passed; it's purely a build-tooling incompatibility).
Bumped to AGP 8.13.2 (bundles R8 8.13.19) — deliberately the latest 8.x patch, not a jump to AGP 9.x, since that would force Hilt 2.58 -> 2.59+ per #582's own investigation (2.58 is pinned as the last pre-AGP-9-required Hilt release). Gradle wrapper bumped 8.11.1 -> 8.13 to match AGP 8.13.2's stated minimum, via
./gradlew wrapper --gradle-version 8.13 --distribution-type bin(not hand-edited).All three hardcoded copies updated together per #582's own note (
gradle/libs.versions.toml,build-logic/convention/build.gradle.kts, wrapper files) — build-logic can't see the root version catalog.Verified, not assumed (see commit message for full detail):
:app:assembleFdroidDebugclean, including the legacyapplicationVariants/BaseVariantOutputImplAPI this project's APK-renaming logic depends onDexingNoClasspathTransformstep that failed in Android build: AGP 8.9.1 / Kotlin 2.2.10 R8 metadata mismatch hangs androidTest builds (D8 "Should never be called") #582's CircleCI run (:app:assembleFdroidDebugAndroidTest+:core:vaultcontent:assembleDebugAndroidTest) — zero D8 warnings across the full log, vs. 10,751 repeated stack-trace lines beforeNot verified locally (no emulator/KVM in this environment) — real
connectedAndroidTestexecution on CircleCI'sui-testsjob. That's the next real signal once this merges.