From 1d69042b3a67871adb4c9b893f53cc3c66c9e413 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 19 Jul 2026 07:05:15 +0000 Subject: [PATCH] build(deps): bump Android Gradle Plugin to 9.3.0 on JDK 21 only Supersedes #438. AGP 9.3.0's bundled lint calls java.util.List.removeLast() (a JDK 21 SequencedCollection API), so `./gradlew lint` crashes with NoSuchMethodError under JDK 17 while passing under JDK 21. Rather than drop JDK 17 coverage, parameterize the AGP version: - build.gradle reads it from the `agpVersion` Gradle property - gradle.properties defaults it to 9.2.1 (keeps JDK 17, and the JDK-17 test_app publish step, building on the plugin that supports JDK 17) - the build workflow overrides it to 9.3.0 only on the JDK 21 matrix leg via ORG_GRADLE_PROJECT_agpVersion JDK 17 continues to build/lint/test on AGP 9.2.1; JDK 21 exercises 9.3.0. Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_01KxmJDWq6wgCEimH3tGLF5H --- .github/workflows/build.yml | 12 +++++++++++- build.gradle | 2 +- gradle.properties | 6 ++++++ 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 51822f08d..b309e1832 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -26,7 +26,17 @@ jobs: # made JDK-specific by their compile targets: # logback-android -> Java 11 bytecode, minSdk 26 # logback-android-jdk8 -> Java 8 bytecode, minSdk 21 - java: [17, 21] + # + # agp: the Android Gradle Plugin version to build with (overrides the + # gradle.properties default). AGP 9.3.0+ lint requires JDK 21, so JDK 17 + # stays on 9.2.1 while JDK 21 exercises the newer plugin. + include: + - java: 17 + agp: '9.2.1' + - java: 21 + agp: '9.3.0' + env: + ORG_GRADLE_PROJECT_agpVersion: ${{ matrix.agp }} steps: - name: Checkout uses: actions/checkout@v7 diff --git a/build.gradle b/build.gradle index 9bba5458b..557700791 100644 --- a/build.gradle +++ b/build.gradle @@ -6,7 +6,7 @@ buildscript { mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:9.2.1' + classpath "com.android.tools.build:gradle:${agpVersion}" // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/gradle.properties b/gradle.properties index 28a1db2d8..f08f9d6c9 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,6 +13,12 @@ VERSION_CODE=3020000 slf4jVersion=2.0.7 +# Android Gradle Plugin version. Defaults to 9.2.1, which still builds under +# JDK 17. CI overrides this to a newer AGP only on the JDK 21 matrix leg (see +# ORG_GRADLE_PROJECT_agpVersion in .github/workflows/build.yml): AGP 9.3.0+ +# lint requires JDK 21 (it calls java.util.List.removeLast(), a JDK 21 API). +agpVersion=9.2.1 + # Specifies the JVM arguments used for the daemon process. # The setting is particularly useful for tweaking memory settings. # Ensure important default jvmargs aren't overwritten. See https://github.com/gradle/gradle/issues/19750