Skip to content

Fix Kotlin 2.3 warnings in Android Gradle builds - #59548

Open
Abbondanzo wants to merge 1 commit into
react:mainfrom
Abbondanzo:export-D127831836
Open

Abbondanzo wants to merge 1 commit into
react:mainfrom
Abbondanzo:export-D127831836

Conversation

@Abbondanzo

@Abbondanzo Abbondanzo commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary:
Kotlin 2.3 introduced warnings that fail the Android Gradle builds when warnings are treated as errors:

  • API version 2.0 is deprecated. Bump apiVersion to KOTLIN_2_1 in the four gradle-plugin build files, as the previous Kotlin upgrade did when it moved from 1.9 to 2.0. Gradle 9, which React Native requires, ships a Kotlin 2.2 runtime, so the plugin still loads on every supported Gradle version.
  • -Xjvm-default is deprecated in favor of -jvm-default. Replace -Xjvm-default=all in ReactAndroid with its equivalent, jvmDefault = JvmDefaultMode.NO_COMPATIBILITY.
  • Kotlin 2.3 reports unnecessary non-null assertions after a smart cast. Remove the redundant !! in JsonUtilsTest.

Changelog:
[Android][Changed] - Bumped the Gradle plugin minimum Kotlin API version to 2.1

Reviewed By: andrewdacenko

Differential Revision: D127831836

@meta-codesync

meta-codesync Bot commented Oct 27, 2026

Copy link
Copy Markdown

@Abbondanzo has exported this pull request. If you are a Meta employee, you can view the originating Diff in D127831836.

@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 Oct 27, 2026
Summary:
Kotlin 2.3 introduced warnings that fail the Android Gradle builds when warnings are treated as errors:

- API version 2.0 is deprecated. Bump `apiVersion` to `KOTLIN_2_1` in the four gradle-plugin build files, as the previous Kotlin upgrade did when it moved from 1.9 to 2.0. Gradle 9, which React Native requires, ships a Kotlin 2.2 runtime, so the plugin still loads on every supported Gradle version.
- `-Xjvm-default` is deprecated in favor of `-jvm-default`. Replace `-Xjvm-default=all` in `ReactAndroid` with its equivalent, `jvmDefault = JvmDefaultMode.NO_COMPATIBILITY`.
- Kotlin 2.3 reports unnecessary non-null assertions after a smart cast. Remove the redundant `!!` in `JsonUtilsTest`.

Changelog:
[Android][Changed] - Bumped the Gradle plugin minimum Kotlin API version to 2.1

Reviewed By: andrewdacenko

Differential Revision: D127831836
@meta-codesync meta-codesync Bot changed the title Bump Gradle plugin Kotlin API version from 2.0 to 2.1 Fix Kotlin 2.3 warnings in Android Gradle builds Oct 27, 2026

This branch has not been deployed

No deployments
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. meta-exported p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant