Repository navigation
[Android] Bump Kotlin to 2.4.21 - #59888
Merged
Merged
Conversation
Contributor
Author
|
The Kotlin 2.1 API target stays unchanged for compatibility. This PR suppresses only DEPRECATED_LANGUAGE_VERSION to keep build_android warnings-as-errors enabled; the suppression should be removed in RN 0.90 when the API target is updated. |
cortinico
marked this pull request as ready for review
November 13, 2026 13:27
cortinico
enabled auto-merge (squash)
November 13, 2026 13:27
Contributor
Author
|
Once this lands this other PR also needs merging: |
javache
approved these changes
Nov 13, 2026
usama-liaqat
pushed a commit
to usama-liaqat/react-native
that referenced
this pull request
Nov 14, 2026
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:
Update Kotlin from 2.3.21 to 2.4.21 in the Gradle plugin, ReactAndroid, and the HelloWorld Android sample. This updates build tooling only; no React Native runtime or public API is changed. Keep the Gradle plugin API target at Kotlin 2.1 for compatibility. Kotlin 2.4 reports a deprecation warning for that older API target. Suppress only
DEPRECATED_LANGUAGE_VERSIONfor now, while keeping all other Kotlin warnings as errors; remove the suppression in RN 0.90. Remove two redundant RobolectricREALISTICannotations (Robolectric documents that mode as the default) to avoid deprecated enum usage in Kotlin unit tests.Changelog:
[ANDROID] [CHANGED] - Update the Kotlin compiler and Gradle plugin to 2.4.21
Test Plan:
cd private/helloworld/android && REACT_NATIVE_DOWNLOADS_DIR=/Users/ncor/git/react-native/packages/react-native/ReactAndroid/build/downloads JAVA_TOOL_OPTIONS='-Djava.io.tmpdir=/private/tmp -Dhttps.proxyHost=localhost -Dhttps.proxyPort=10054 -Dhttp.proxyHost=localhost -Dhttp.proxyPort=10054' ./gradlew -p /Users/ncor/git/react-native/packages/react-native --include-build /Users/ncor/git/react-native/packages/gradle-plugin :packages:react-native:ReactAndroid:testDebugUnitTest --tests com.facebook.react.views.text.TextDecorationStyleTest --tests com.facebook.react.views.text.TextLayoutManagerPixelWidthTest -x :packages:react-native:ReactAndroid:hermes-engine:buildHermesC -PenableWarningsAsErrors=true --console plain -Dhttps.proxyHost=localhost -Dhttps.proxyPort=10054 -Dhttp.proxyHost=localhost -Dhttp.proxyPort=10054— passed. The unrelated local Hermes CMake prerequisite was excluded; CI builds Hermes normally.cd packages/gradle-plugin && JAVA_TOOL_OPTIONS=-Djava.io.tmpdir=/private/tmp ./gradlew build --rerun-tasks -PenableWarningsAsErrors=true --warning-mode all --console plain -Dhttps.proxyHost=localhost -Dhttps.proxyPort=10054 -Dhttp.proxyHost=localhost -Dhttp.proxyPort=10054— passed (22 tasks executed, no Kotlin compiler warnings).cd packages/gradle-plugin && JAVA_TOOL_OPTIONS=-Djava.io.tmpdir=/private/tmp ./gradlew build --rerun-tasks --warning-mode all --console plain -Dhttps.proxyHost=localhost -Dhttps.proxyPort=10054 -Dhttp.proxyHost=localhost -Dhttp.proxyPort=10054— passed. Reports the expected Kotlin API 2.1 deprecation warning.cd private/helloworld/android && REACT_NATIVE_DOWNLOADS_DIR=/Users/ncor/git/react-native/packages/react-native/ReactAndroid/build/downloads JAVA_TOOL_OPTIONS=-Djava.io.tmpdir=/private/tmp ./gradlew -p /Users/ncor/git/react-native/packages/react-native --include-build /Users/ncor/git/react-native/packages/gradle-plugin :packages:react-native:ReactAndroid:assembleDebug --warning-mode all --console plain -Dhttps.proxyHost=localhost -Dhttps.proxyPort=10054 -Dhttp.proxyHost=localhost -Dhttp.proxyPort=10054— passed. No Kotlin compiler deprecations; existing Java deprecated-API usage and an unrelated CMake warning remain.git diff --check— passed.Library-specific Android tooling compatibility has not been exhaustively tested.
Matching template draft PR: react-native-community/template#262