Skip to content

fix(build): bump AGP 8.9.1 -> 8.13.2, Gradle 8.11.1 -> 8.13 (#582) - #672

Merged
libravault-xyz merged 4 commits into
devfrom
fix/agp-8.13-r8-kotlin-metadata-582
Aug 26, 2026
Merged

libravault-xyz merged 4 commits into
devfrom
fix/agp-8.13-r8-kotlin-metadata-582

Conversation

@libravault-xyz

Copy link
Copy Markdown
Collaborator

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):

Not verified locally (no emulator/KVM in this environment) — real connectedAndroidTest execution on CircleCI's ui-tests job. That's the next real signal once this merges.

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>
@libravault-xyz libravault-xyz added the circleci-job Manually trigger the CircleCI fallback pipeline for this PR/issue label Aug 26, 2026
@github-actions github-actions Bot added the risk:high Touches a sensitive path or exceeds diff-size threshold — always human merge label Aug 26, 2026
@libravault-pipeline-bot libravault-pipeline-bot Bot added the status:needs-qa PR open, awaiting qa-agent verification label Aug 26, 2026
@github-actions

Copy link
Copy Markdown
Contributor

This PR was opened outside the automated pipeline (author isn't libravault-pipeline-bot[bot]), so dev-agent.yml's own end-of-run classification step never ran for it — it would otherwise have sat with no risk/status label and nothing downstream would pick it up (see issue #223's actual history). This deterministic backstop (pr-intake.yml) classified its risk and applied status:needs-qa to route it into the normal pipeline from here.

@libravault-xyz libravault-xyz added circleci-job Manually trigger the CircleCI fallback pipeline for this PR/issue and removed circleci-job Manually trigger the CircleCI fallback pipeline for this PR/issue labels Aug 26, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📱 iOS Build Status: PASSED

⏭️ iOS Simulator Build & Unit Tests - skipped
✅ Android Core Modules - success

iOS UI tests run in a separate, informational job and are not reflected above — check "iOS UI Tests (informational)" for those.

View run details

@github-actions

Copy link
Copy Markdown
Contributor

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

@github-actions github-actions Bot removed the circleci-job Manually trigger the CircleCI fallback pipeline for this PR/issue label Aug 26, 2026
@github-actions

Copy link
Copy Markdown
Contributor

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

@claude

claude Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

QA verification — PR #672 vs issue #582

Issue #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 — PASS

Ran the exact failing step from #582's CircleCI evidence myself, on this branch:

./gradlew :app:assembleFdroidDebug :app:assembleFdroidDebugAndroidTest :core:vaultcontent:assembleDebugAndroidTest

BUILD SUCCESSFUL in 3m 36s (503 tasks). Grepped the full log for D8|should never be called|kotlin metadata — zero matches, vs. the 10,751 repeated stack-trace lines #582 documented pre-fix. The competing PR #592 independently reproduced the exact same R8_8.9.32 ... Should never be called crash locally at AGP 8.9.1 (commit 13d0c07) and confirmed it clean at a bumped AGP — consistent with this PR's own root-cause diagnosis.

Real test suite — PASS

./gradlew testDebugUnitTest --continue

BUILD SUCCESSFUL in 10m 9s, 454 actionable tasks (344 executed, 110 from cache), no failures, no regressions from the toolchain bump.

Diff verification — PASS

  • gradle/libs.versions.toml: agp 8.9.1 → 8.13.2, confirmed. Comment claims R8 8.13.19 covers Kotlin 2.2's R8 8.10.21 minimum — consistent with the observed clean dexing run above. hilt/room/kotlin/ksp pins confirmed untouched, as claimed.
  • build-logic/convention/build.gradle.kts: hardcoded compileOnly("com.android.tools.build:gradle:...") bumped to match — this is the third hardcoded copy Android build: AGP 8.9.1 / Kotlin 2.2.10 R8 metadata mismatch hangs androidTest builds (D8 "Should never be called") #582 explicitly flagged as easy to miss; confirmed updated.
  • gradle/wrapper/gradle-wrapper.properties + gradlew/gradlew.bat/gradle-wrapper.jar: bumped 8.11.1 → 8.13, diff shape matches a real ./gradlew wrapper --gradle-version 8.13 regeneration (not hand-edited), not just a version-string edit.
  • The comment claiming compileSdk is "pinned at 36 — see AndroidCommonExtensions.kt" checks out: build-logic/convention/src/main/kotlin/AndroidCommonExtensions.kt:10 — compileSdk = 36.
  • Verified the PR's citation that Hilt 2.58 is deliberately pinned as the last pre-AGP-9-required release (its stated reason for stopping at AGP 8.13.2 rather than jumping to 9.x) against real repo history: commit 8330c17 (PR feat(player): implement real chapter extraction for audiobooks #103, 2026-08-12) documents exactly this constraint. Not a fabricated citation.

AGENTS.md conventions — PASS

  • Branch fix/agp-8.13-r8-kotlin-metadata-582 matches fix/<short-slug>.
  • Commit message uses Conventional Commits (fix(build): ...), single concern, one commit.
  • This is a dependency-version-only / build-script bump — AGENTS.md explicitly exempts this category from the "ship unit tests" requirement, so no test-coverage gap here.

Not independently verified

Real connectedAndroidTest on an emulator (no KVM/emulator in this QA environment either) — the PR itself is upfront that this is the one remaining signal, deferred to CI's ui-tests job. Given the dexing step (the actual documented blocker — all 25 real test cases already passed pre-fix per #582) is now confirmed clean, this is a reasonable residual gap, not a fail condition.

Note for whoever handles merge (not a QA blocker)

Issue #582 currently has two open PRs: #592 (AGP → 8.10.1, already status:needs-human-merge) and this one, #672 (AGP → 8.13.2, newer/further target with the same root-cause fix). Both are legitimate independent fixes for the same issue — a human merge decision is needed on which to carry forward to avoid a duplicate-file conflict merging both. This doesn't affect this PR's own correctness.

QA verdict: PASS

@github-actions github-actions Bot removed the status:needs-qa PR open, awaiting qa-agent verification label Aug 26, 2026
@libravault-pipeline-bot libravault-pipeline-bot Bot added the status:needs-review QA passed, awaiting principal-review-agent label Aug 26, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Principal review — verdict: human-merge

Risk classification: risk:high is correct and current (single commit on this PR, label matches head). It's triggered purely by sensitive_paths matches on gradle/libs.versions.toml and build-logic/** (agent-policy.yml's dependency/toolchain-pinning rule) — not by any defect found in review. Routing to a human solely for that label; the change itself checks out.

What I verified myself (not just read the PR's claims):

  • ./gradlew --version — confirms the regenerated wrapper (gradlew, gradlew.bat, gradle-wrapper.jar, gradle-wrapper.properties) is genuine and functional: it downloaded and ran real Gradle 8.13 from services.gradle.org, matching the distributionUrl bump. Not a hand-edited/tampered wrapper.
  • ./gradlew :app:assembleFdroidDebug — BUILD SUCCESSFUL (6m37s), including the legacy applicationVariants/BaseVariantOutputImpl API the APK-renaming logic depends on, as claimed.
  • ./gradlew :app:assembleFdroidDebugAndroidTest :core:vaultcontent:assembleDebugAndroidTest — BUILD SUCCESSFUL, and I grepped the full log for D8:/WARNING/Should never be called/Unexpected error: zero hits. This is the exact DexingNoClasspathTransform step that hung 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; confirmed clean here, matching the PR's central claim.
  • ./gradlew testDebugUnitTest testFdroidDebugUnitTest testPlayDebugUnitTest — BUILD SUCCESSFUL, no regressions from the toolchain bump.
  • Diffed gradle/libs.versions.toml against dev: only the agp line and one stale-comment fix (compileSdk-36 rationale, now pointing at AndroidCommonExtensions.kt instead of citing AGP 8.9.1's "recommended max," which would've gone stale post-bump — good catch). kotlin, ksp, hilt, room, compose-bom all untouched, matching the "stay under AGP 9" rationale.
  • Confirmed all three hardcoded AGP-version copies were updated together (gradle/libs.versions.toml, build-logic/convention/build.gradle.kts) — grepped the repo for any remaining 8.9.1 reference outside build/: none found.
  • No .github/workflows/** or .circleci/** changes, no new networking dependency, no other sensitive_paths hits beyond the two intentional ones above.
  • Diff is 23 insertions / 11 deletions across 6 files — well under the 400-line auto-merge threshold; risk:high here is 100% the sensitive-path rule, not size.
  • Per AGENTS.md, build-script/dependency-version-only bumps are explicitly exempt from the "ship unit tests" requirement — correctly no new tests added.

Not independently verified (as the PR itself discloses): real connectedAndroidTest execution on CircleCI's ui-tests job — no emulator/KVM in this environment. The dexing step was the full documented blocker in #582 (all 25 real tests already passed there), and that step is now confirmed clean, but the end-to-end emulator run is still the next real signal per the PR's own description.

Findings: none at CONFIRMED severity. No issue filed.

Recommend merging as-is once CircleCI's ui-tests job confirms green.

@github-actions github-actions Bot added status:needs-human-merge Principal review done, requires human merge decision and removed status:needs-review QA passed, awaiting principal-review-agent labels Aug 26, 2026
…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>
@libravault-xyz libravault-xyz added the circleci-job Manually trigger the CircleCI fallback pipeline for this PR/issue label Aug 26, 2026
@github-actions

Copy link
Copy Markdown
Contributor

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

@github-actions github-actions Bot removed the circleci-job Manually trigger the CircleCI fallback pipeline for this PR/issue label Aug 26, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📱 iOS Build Status: PASSED

⏭️ iOS Simulator Build & Unit Tests - skipped
✅ Android Core Modules - success

iOS UI tests run in a separate, informational job and are not reflected above — check "iOS UI Tests (informational)" for those.

View run details

@libravault-xyz libravault-xyz added the circleci-job Manually trigger the CircleCI fallback pipeline for this PR/issue label Aug 26, 2026
@github-actions

Copy link
Copy Markdown
Contributor

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.
@libravault-xyz libravault-xyz added the circleci-job Manually trigger the CircleCI fallback pipeline for this PR/issue label Aug 26, 2026
@github-actions

Copy link
Copy Markdown
Contributor

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

@github-actions github-actions Bot removed the circleci-job Manually trigger the CircleCI fallback pipeline for this PR/issue label Aug 26, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📱 iOS Build Status: PASSED

⏭️ iOS Simulator Build & Unit Tests - skipped
✅ Android Core Modules - success

iOS UI tests run in a separate, informational job and are not reflected above — check "iOS UI Tests (informational)" for those.

View run details

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.
@libravault-xyz libravault-xyz added the circleci-job Manually trigger the CircleCI fallback pipeline for this PR/issue label Aug 26, 2026
@github-actions

Copy link
Copy Markdown
Contributor

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

@github-actions github-actions Bot removed the circleci-job Manually trigger the CircleCI fallback pipeline for this PR/issue label Aug 26, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📱 iOS Build Status: PASSED

⏭️ iOS Simulator Build & Unit Tests - skipped
✅ Android Core Modules - success

iOS UI tests run in a separate, informational job and are not reflected above — check "iOS UI Tests (informational)" for those.

View run details

@libravault-xyz
libravault-xyz merged commit 8e200b7 into dev Aug 26, 2026
20 checks passed
@libravault-xyz
libravault-xyz deleted the fix/agp-8.13-r8-kotlin-metadata-582 branch August 26, 2026 20:58
github-actions Bot added a commit that referenced this pull request Aug 26, 2026
…682)

Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk:high Touches a sensitive path or exceeds diff-size threshold — always human merge status:needs-human-merge Principal review done, requires human merge decision

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Android build: AGP 8.9.1 / Kotlin 2.2.10 R8 metadata mismatch hangs androidTest builds (D8 "Should never be called")

2 participants