Commit 53c90d6
committed
Upgrade Gradle to 9.4 (AGP to 9.1, Kotlin to 2.3)
## Summary:
Follow-up to
+ #55453
+ react-native-community/template#205
- bump Gradle wrappers 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 (RNGP)
- bump RNGP Kotlin compiler API ver from KOTLIN_1_8 to KOTLIN_2_3 (RNGP)
- AGP 9 DSL syntax updates
- NB: AGP 9.1 removed direct prop accessors, replaced by lambdas (DSL closures)
- ReactPlugin.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 objects)
- AgpConfiguratorUtils.kt
- fix: unresolved ref 'namespace', update to lambdas
- fix: NoSuchMethodError for buildFeatures, 'LibraryBuildFeatures LibraryExtension.getBuildFeatures()', update to lambdas
- NdkConfiguratorUtils.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
- JsonUtilsTest.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 as done in past
Then follow-up react-native-community/template gradlew and kotlinVersion updates e.g. leotm/react-native-template-new-architecture#1933
## Changelog:
[ANDROID] [CHANGED] - Gradle to 9.4.0, Kotlin 2.3.0 and AGP 9.1.0 support
## 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 :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:buildCMakeDebug[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)1 parent d1809f0 commit 53c90d6
13 files changed
Lines changed: 108 additions & 95 deletions
File tree
- gradle/wrapper
- packages
- gradle-plugin
- gradle
- wrapper
- react-native-gradle-plugin
- src/main/kotlin/com/facebook/react
- utils
- settings-plugin
- react-native/ReactAndroid
- private/helloworld/android/gradle/wrapper
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | | - | |
| 67 | + | |
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| |||
Lines changed: 3 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
231 | 231 | | |
232 | 232 | | |
233 | 233 | | |
| 234 | + | |
234 | 235 | | |
235 | 236 | | |
236 | 237 | | |
237 | | - | |
| 238 | + | |
238 | 239 | | |
239 | 240 | | |
240 | 241 | | |
241 | 242 | | |
242 | | - | |
| 243 | + | |
243 | 244 | | |
244 | 245 | | |
245 | 246 | | |
| |||
Lines changed: 26 additions & 23 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
13 | 12 | | |
14 | 13 | | |
15 | 14 | | |
| |||
59 | 58 | | |
60 | 59 | | |
61 | 60 | | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
74 | 75 | | |
75 | 76 | | |
76 | 77 | | |
| |||
82 | 83 | | |
83 | 84 | | |
84 | 85 | | |
85 | | - | |
| 86 | + | |
86 | 87 | | |
87 | 88 | | |
88 | 89 | | |
| |||
97 | 98 | | |
98 | 99 | | |
99 | 100 | | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
107 | 110 | | |
108 | 111 | | |
109 | 112 | | |
| |||
118 | 121 | | |
119 | 122 | | |
120 | 123 | | |
121 | | - | |
122 | | - | |
| 124 | + | |
| 125 | + | |
123 | 126 | | |
124 | 127 | | |
125 | 128 | | |
| |||
Lines changed: 26 additions & 24 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
57 | 58 | | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
63 | 65 | | |
64 | 66 | | |
65 | 67 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
57 | | - | |
| 57 | + | |
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
| 36 | + | |
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| |||
0 commit comments