Skip to content

Kotlin to 2.1.20#50780

Closed
cortinico wants to merge 1 commit into
facebook:mainfrom
cortinico:export-D73122000
Closed

Kotlin to 2.1.20#50780
cortinico wants to merge 1 commit into
facebook:mainfrom
cortinico:export-D73122000

Conversation

@cortinico
Copy link
Copy Markdown
Contributor

Summary:
This bumps Kotlin to the latest stable: 2.1.20.
I've also fixed several warnings emitted by the new compiler.

Changelog:
[Android] [Changed] - Kotlin to 2.1.20

Differential Revision: D73122000

@facebook-github-bot facebook-github-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 Apr 17, 2025
@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D73122000

Summary:

This bumps Kotlin to the latest stable: 2.1.20.
I've also fixed several warnings emitted by the new compiler.

Changelog:
[Android] [Changed] - Kotlin to 2.1.20

Differential Revision: D73122000
@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D73122000

@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label Apr 17, 2025
@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request has been merged in a3d38d5.

@react-native-bot
Copy link
Copy Markdown
Collaborator

This pull request was successfully merged by @cortinico in a3d38d5

When will my fix make it into a release? | How to file a pick request?

uffoltzl pushed a commit to uffoltzl/react-native that referenced this pull request Apr 18, 2025
Summary:
Pull Request resolved: facebook#50780

This bumps Kotlin to the latest stable: 2.1.20.
I've also fixed several warnings emitted by the new compiler.

Changelog:
[Android] [Changed] - Kotlin to 2.1.20

Reviewed By: rshest

Differential Revision: D73122000

fbshipit-source-id: 019a01d085b2c115a3efcf567056e9990a1ff0ce
leotm added a commit to leotm/react-native-1 that referenced this pull request Apr 25, 2026
## Summary:

Follow-up to
+ facebook#50780
  + react-native-community/template#118
+ facebook#52973
+ facebook#55453
  + react-native-community/template#205
+ react-native-community/template#69

- bump Gradle wrappers from 9.3.1 to 9.4.0 (root, RNGP, helloworld)
  - Java 26 support
- bump RNGP: AGP from 8.12.0 to 9.1.0, Kotlin from 2.1.20 to 2.3.0 (RNGP)
- bump RNGP Kotlin compiler API ver from KOTLIN_1_8 to KOTLIN_2_3 (RNGP)
  - or preserve lower API ver as before
- AGP 9 DSL syntax updates
  - NB: AGP 9.1 removed direct prop accessors, replaced by lambdas (DSL closures)
  - React Plugin .kt
    - fix: arg type mismatch: actual type is File, String expected
    - old .asFile returns File, directories.add() needs String, use .asFile.absolutePath to convert File to String path
    - NB: AGP 9 replaced .srcDir with directories.add, expects String paths (not File objs)
  - AGP config utils .kt
    - fix: unresolved ref 'namespace' - update to lambdas
    - fix: NoSuchMethodError for buildFeatures, 'LibraryBuildFeatures LibraryExtension.getBuildFeatures()' - update to lambdas
  - NDK config utils .kt
    - fix: com.android.build.api.dsl. ApplicationBuildFeatures ApplicationExtension.getBuildFeatures breaking rn-tester createBundleReleaseJsAndAssets - update to lambdas
    - fix: com.android.build.api.dsl. ApplicationDefaultConfig ApplicationExtension.getDefaultConfig() breaking rn-tester createBundleReleaseJsAndAssets - update to lambdas
  - ReactAndroid build.gradle .kts
    - fix: java.exclude Unresolved ref 2 script compilation errors - refactor legacy Java source exclusion to explicit filter patterns (Ant-style globs)
    - NB: AGP 9 AndroidSourceDirectorySet stopped extending PatternFilterable
- JSON Utils tests .kt
  - fix: :gradle-plugin:shared:compileTestKotlin 40 warnings as errors Unnecessary non-null assertion (!!) on a non-null receiver - assert null once at entry point of vars
- /helloworld
  - fix: Failed to apply plugin 'org.jetbrains.kotlin.android' in :app no longer required for Kotlin support since AGP 9 - remove from app/build.gradle
  - NB: remaining 'org.jetbrains.kotlin.android' refs can be fully removed from codebase after, keeping this PR scope minimal
  - NB: this is required in @react-native-community/template first, for test_e2e_android_templateapp debug/release (init-project-e2e.js RNTestProject) to pass final CI checks
+ @react-native-community/template TODO
  + remove plugin 'org.jetbrains.kotlin.android' (required to pass CI test_e2e_android_templateapp check)
  + bump Kotlin from 2.1.20 to 2.3.0
  + bump Gradle from 9.3.1 to 9.4.0 (how it all started)
  + example: leotm/react-native-template-new-architecture#1933

## Changelog:

[ANDROID] [CHANGED] - Upgradle to Gradle 9.4, Kotlin 2.3, AGP 9.1 and support Java 26

## Test Plan:

+ template: leotm/react-native-template-new-architecture#1933
- locally (windows 11, CMake: 3.30.5, 4.3.1, JDK 17, JDK 26 security incompatible)
- .github/actions/build-android/action.yml with prebuilt stable com.facebook.hermes:hermes-android:0.16.0 artifact from mvnrepository.com/artifact/com.facebook.hermes/hermes-android/0.16.0
- useHermesStable=true, useHermesNightly=false, hermesV1Enabled=false, .hermesversion, version.properties
- set: ANDROID_SDK_ROOT, JAVA_HOME, NODE_HOME (prepend all to PATH)
- ~~.\gradlew .\gradlew :private:react-native-fantom:buildFantomTester~~ locally on 0.16.0 tarball 404
- .\gradlew :packages:react-native:ReactAndroid:tasks
- .\gradlew :packages:react-native:ReactAndroid:build --dry-run
- .\gradlew :packages:react-native:ReactAndroid:buildCodegenCLI -PreactNativeArchitectures=arm64-v8a PenableWarningsAsErrors=true --no-daemon
  - fix buildCodegenCLI locally for Windows Git Bash compat
- .\gradlew :gradle-plugin:react-native-gradle-plugin:compileKotlin -PenableWarningsAsErrors=true --no-daemon
- .\gradlew :packages:rn-tester:android:app:createBundleReleaseJsAndAssets -PenableWarningsAsErrors=true --no-daemon
- .\gradlew :packages:react-native:ReactAndroid:buildCMakeRelease[arm64-v8a][hermestooling,jsi,etc] -PenableWarningsAsErrors=true --no-daemon
- .\gradlew :packages:react-native:ReactAndroid:build -PreactNativeArchitectures=arm64-v8a -PenableWarningsAsErrors=true --no-daemon
- .github\actions\build-fantom-runner\action.yml locally requires private:react-native-fantom and compiling hermes from source w debug flags (SLOW af)
+ react-native-community/template: .\gradlew app:assembleRelease
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. fb-exported Merged This PR has been merged. p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants