build: target JDK 17 for published library modules - #2
Merged
Conversation
Consumers running unit tests on a Java 17 JVM (Robolectric) fail with UnsupportedClassVersionError because upstream's AGP 9 bump moved the toolchain to 21. Publish class files targeting 17 instead. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Robolectric tests exercise Android SDK levels that require a Java 21 runtime, so the toolchain stays at 21; javac and kotlinc emit 17. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Fixes the AndroidGradlePluginVersion lint error (warningsAsErrors). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Upstream's AGP 9 bump moved the toolchain to JDK 21, so
4.4.0-ws.1ships class files v65. Consumers running Robolectric unit tests on a Java 17 JVM fail withUnsupportedClassVersionErrorand have to force a 21+ test JVM via toolchains.Approach: the build and tests keep running on JDK 21 (Robolectric needs a 21 runtime for the newest Android SDK levels), but
libraryandlibrary-no-opnow emit Java 17 bytecode:compileOptionssource/target 17 + KotlinjvmTarget = JVM_17.Also bumps AGP 9.2.1 → 9.3.0 to fix the unrelated
AndroidGradlePluginVersionlint error (warningsAsErrors) that started failing when 9.3.0 was released.Verified locally:
:library:testDebugUnitTest,assembleRelease,lintDebugpass; AAR class files are major version 61 (Java 17).After merge: publish as
v4.4.0-ws.2(release tag drives the published version).🤖 Generated with Claude Code