Repository navigation
Fix Kotlin 2.3 warnings in Android Gradle builds (#59548) - #59548
Merged
Merged
Conversation
|
@Abbondanzo has exported this pull request. If you are a Meta employee, you can view the originating Diff in D127831836. |
Abbondanzo
force-pushed
the
export-D127831836
branch
3 times, most recently
from
October 27, 2026 19:59
e4acf5f to
f7f9cf5
Compare
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 more redundant casts, non-null assertions, safe calls and Elvis operators after smart casts or on non-null platform types. Remove them in the gradle-plugin `JsonUtilsTest`, in `ReactAndroid` sources (`WritableNativeArray`, `MountItemDispatcher`, `PreAllocateViewMountItem`, `AppStateModule`, `NetworkingModule`, `UIManagerModule`, `ReactTextViewAccessibilityDelegate`) and in `ReactAndroid` unit tests (`NativeAnimatedNodeTraversalTest`, `DeviceInfoModuleTest`, `UIManagerModuleConstantsTest`). Changelog: [Android][Changed] - Bumped the Gradle plugin minimum Kotlin API version to 2.1 Reviewed By: andrewdacenko Differential Revision: D127831836
Abbondanzo
force-pushed
the
export-D127831836
branch
from
October 27, 2026 20:15
f7f9cf5 to
0fe823e
Compare
Visual regressionNo visual differences at ios: no capture |
javache
approved these changes
Oct 28, 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:
Kotlin 2.3 introduced warnings that fail the Android Gradle builds when warnings are treated as errors:
apiVersiontoKOTLIN_2_1in 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-defaultis deprecated in favor of-jvm-default. Replace-Xjvm-default=allinReactAndroidwith its equivalent,jvmDefault = JvmDefaultMode.NO_COMPATIBILITY.JsonUtilsTest, inReactAndroidsources (WritableNativeArray,MountItemDispatcher,PreAllocateViewMountItem,AppStateModule,NetworkingModule,UIManagerModule,ReactTextViewAccessibilityDelegate) and inReactAndroidunit tests (NativeAnimatedNodeTraversalTest,DeviceInfoModuleTest,UIManagerModuleConstantsTest).Changelog:
[Android][Changed] - Bumped the Gradle plugin minimum Kotlin API version to 2.1
Reviewed By: andrewdacenko
Differential Revision: D127831836