Bump Gradle to 9.4 (Kotlin to 2.3, AGP to 9.1)#56222
Draft
leotm wants to merge 2 commits intofacebook:mainfrom
Draft
Bump Gradle to 9.4 (Kotlin to 2.3, AGP to 9.1)#56222leotm wants to merge 2 commits intofacebook:mainfrom
leotm wants to merge 2 commits intofacebook:mainfrom
Conversation
a79ccba to
58dc716
Compare
## Summary: Follow-up to + facebook#55453 + react-native-community/template#205 - bump Gradle wrapper from 9.3.1 to 9.4.0 (root, RNGP, helloworld) - bump RNGP: AGP from 8.12.0 to 9.1.0, Kotlin from 2.1.20 to 2.3.0 - bump RNGP Kotlin compiler API ver from KOTLIN_1_8 to KOTLIN_2_3 - AGP 9.1 DSL syntax updates - ReactPlugin.kt - fix: 'Argument type mismatch: actual type is File, but String was expected' - AGP 9.1 changed java.srcDir() to use directories.add(), expects String paths (not File objects) - old .asFile returns File, directories.add() needs a String - use .asFile.absolutePath to convert File to String path - AgpConfiguratorUtils.kt - fix: unresolved reference 'namespace' - AGP 9.1 removed direct namespace prop from LibraryAndroidComponentsExtension - use components.finalizeDsl { dsl -> dsl.namespace = ... } - fix: NoSuchMethodError for buildFeatures, 'LibraryBuildFeatures LibraryExtension.getBuildFeatures()' - AGP 9.1 removed direct property accessors and changed buildFeatures API to use lambda syntax - change `buildFeatures` and `defaultConfig` from direct property assignment to lambda syntax (`ext.buildFeatures { ... }` instead of `ext.buildFeatures`) - change `defaultConfig.buildConfigField()` and `defaultConfig.resValue()` to use lambda syntax (`ext.defaultConfig { ... }`) - NdkConfiguratorUtils.kt - remove deprecated `ext.buildFeatures.prefab = true` (AGP 9.1+ libs declare prefab config directly in their build.gradle) - replace direct `cmake.arguments` manipulation with `ext.defaultConfig { }` lambda syntax - keep manual CMake argument additions (PROJECT_BUILD_DIR, PROJECT_ROOT_DIR, REACT_ANDROID_DIR, REACT_COMMON_DIR, ANDROID_STL, ANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES) - NB: AGP 9.1 changed DSL access - `defaultConfig` is now a lambda method, not a direct property - ReactAndroid/build.gradle.kts - remove `java.exclude()` calls for processing and module processing packages causing AGP 9.1 compilation errors - rn-tester/build.gradle.kts - change from `afterEvaluate` block to `tasks.withType<>().configureEach` - update task deps to use `configureEach` instead of `getByName()` - NB: more reliable task config w AGP 9.1 - JsonUtilsTest.kt - fix :gradle-plugin:shared:compileTestKotlin warnings, unnecessary non-null assertion (!!) on a non-null receiver of type '...' - causing :packages:rn-tester:android:app:benchmark:stripHermesBenchmarkDebugSymbols to fail then configureCMakeDebug Then follow-up react-native-community/template gradlew and kotlinVersion updates ## Changelog: [ANDROID] [CHANGED] - Gradle to 9.4.0, Kotlin 2.3.0 and AGP 9.1.0 ## Test Plan: - leotm/react-native-template-new-architecture#1933 - .github/actions/build-android/action.yml locally with prebuilt hermes-android mvnrepository.com/artifact/com.facebook.hermes/hermes-android/0.16.0 - JDK 26 sec incompat, JDK 17 ok, prebuilt stable com.facebook.hermes:hermes-android:0.16.0 artifact - useHermesStable=true, useHermesNightly=false, hermesV1Enabled=false, .hermesversion, version.properties, skip buildCodegenCLI - --dry-run -PreactNativeArchitectures=arm64-v8a -PenableWarningsAsErrors=true - .github\actions\build-fantom-runner\action.yml locally requires private:react-native-fantom and compiling hermes from source w debug flags (SLOW)
- fix compileTestKotlin warnings by removing redundant null assertions and storing dependencies in local variables - add generateReactAndroidConfig task to gen ReactAndroidConfig.cmake for find_package() support - fix CMakeTask configuration to use tasks.configureEach instead of tasks.withType for internal AGP classes
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:
Follow-up to
Then follow-up react-native-community/template gradlew and kotlinVersion updates
Changelog:
[ANDROID] [CHANGED] - Gradle to 9.4.0, Kotlin 2.3.0 and AGP 9.1.0
Test Plan: