fix(android): bump JVM target from 11 to 17#68
Draft
airowe wants to merge 1 commit into
Draft
Conversation
React Native 0.80+ ships with Gradle/AGP defaults that compile host
app Java with JVM 17. AGP's `JavaCompile` / `KotlinCompile` consistency
check fails the Kotlin compile task when this library's `jvmTarget`
("11") disagrees with the consumer's compileJavaWithJavac target ("17").
Bumping both `sourceCompatibility`/`targetCompatibility` and
`kotlinOptions.jvmTarget` to 17 aligns the library with the modern RN
toolchain. Apps still on JVM 11 are unaffected as long as their AGP
version supports JDK 17 source level (AGP 7.4+).
Repro: any RN 0.80+ host project pulling `@frontegg/react-native`
fails `:react-native_frontegg:compileDebugKotlin` with:
> Inconsistent JVM-target compatibility detected for tasks
> 'compileDebugJavaWithJavac' (17) and 'compileDebugKotlin' (11).
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.
Summary
Bumps
sourceCompatibility/targetCompatibility/kotlinOptions.jvmTargetinandroid/build.gradlefrom 11 to 17 so the library compiles against host apps using the modern React Native / AGP defaults.Problem
React Native 0.80+ projects compile host-app Java with JVM 17. AGP enforces JVM-target consistency between
compileDebugJavaWithJavacandcompileDebugKotlin, so any consumer on JVM 17 hits:…on
:react-native_frontegg:compileDebugKotlin. We've been carrying this as apatch-packagepatch on@frontegg/react-native@1.2.16to get the library to build at all.Compatibility note
JDK 17 has been the recommended Android Studio toolchain since Flamingo (April 2023) and is required by AGP 8.x. Host apps still on JDK 11 will need their AGP version to support
sourceCompatibility 17(AGP 7.4+).Manual test plan
Reviewer / maintainer:
cd example/android && ./gradlew :react-native_frontegg:assembleDebugsucceeds. (Before this PR: fails with the JVM-target inconsistency error above.)cd example/android && ./gradlew :app:assembleDebugsucceeds and the example app installs and launches.react-native-sdk-e2e.yml) is green on this branch.The fix is a 6-character config change with no runtime behavior, so unit-test coverage is not added; the gradle build is itself the test.
Tested against (host side)
Related
Part of a small batch of patches we discovered while integrating the SDK; the others are separate PRs (
currentActivitydeprecation,BuildConfiglookup).