Skip to content

[Android] Bump Kotlin to 2.4.21 - #59888

Merged
cortinico merged 5 commits into
react:mainfrom
cortinico:chore/kotlin-2.4.21
Nov 13, 2026
Merged

cortinico merged 5 commits into
react:mainfrom
cortinico:chore/kotlin-2.4.21

Conversation

@cortinico

@cortinico cortinico commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

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_VERSION for now, while keeping all other Kotlin warnings as errors; remove the suppression in RN 0.90. Remove two redundant Robolectric REALISTIC annotations (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

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Nov 9, 2026
@facebook-github-tools facebook-github-tools Bot added p: Facebook Partner: Facebook Partner labels Nov 9, 2026
@cortinico

Copy link
Copy Markdown
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.

@github-actions

Copy link
Copy Markdown

Visual regression

1 visual difference(s) at 3879a12b34fa. Visual differences need maintainer approval. Review the report, then apply visual-change-approved.

ios button/default-styling/default: Changed, 38223 px (1.533%)

diff

Expected and Captured
Expected Captured
expected captured

@cortinico
cortinico marked this pull request as ready for review November 13, 2026 13:27
@cortinico
cortinico enabled auto-merge (squash) November 13, 2026 13:27
@cortinico

Copy link
Copy Markdown
Contributor Author

Once this lands this other PR also needs merging:

@cortinico
cortinico merged commit 751ba61 into react:main Nov 13, 2026
89 of 91 checks passed
usama-liaqat pushed a commit to usama-liaqat/react-native that referenced this pull request Nov 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants