Skip to content

error upgrading Gradle from 8.3 to 8.13 #54020

@aka-sha512

Description

@aka-sha512

Issue

MacOS Build failure

Versions

Gradle Plugin 0.73.4

React Native 0.73.5

Error

I faced these errors after upgrading Gradle from 8.3 to 8.13 via AGP.

Failed to install the app. Command failed with exit code 1: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
e: file:/node_modules/@react-native/gradle-plugin/build.gradle.kts:10:49: Unresolved reference: serviceOf
e: file:/node_modules/@react-native/gradle-plugin/build.gradle.kts:54:11: Unresolved reference: serviceOf FAILURE: Build failed with an exception.
 * Where:
Build file '/node_modules/@react-native/gradle-plugin/build.gradle.kts' line: 10
 * What went wrong:
Script compilation errors: Line 10: import org.gradle.configurationcache.extensions.serviceOf ^ Unresolved reference: serviceOf Line 54: serviceOf<ModuleRegistry>() ^ Unresolved reference: serviceOf 2 errors

Resolution

The following patch was applied to @react-native/[email protected].

diff --git a/node_modules/@react-native/gradle-plugin/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/node_modules/@react-native/gradle-plugin/.gradle/buildOutputCleanup/buildOutputCleanup.lock
new file mode 100644
index 0000000..7d99c5e
Binary files /dev/null and b/node_modules/@react-native/gradle-plugin/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ
diff --git a/node_modules/@react-native/gradle-plugin/.gradle/buildOutputCleanup/cache.properties b/node_modules/@react-native/gradle-plugin/.gradle/buildOutputCleanup/cache.properties
new file mode 100644
index 0000000..e13de93
--- /dev/null
+++ b/node_modules/@react-native/gradle-plugin/.gradle/buildOutputCleanup/cache.properties
@@ -0,0 +1,2 @@
+#Wed Oct 01 18:09:45 EDT 2025
+gradle.version=8.13
diff --git a/node_modules/@react-native/gradle-plugin/build.gradle.kts b/node_modules/@react-native/gradle-plugin/build.gradle.kts
index 9346508..f80abc4 100644
--- a/node_modules/@react-native/gradle-plugin/build.gradle.kts
+++ b/node_modules/@react-native/gradle-plugin/build.gradle.kts
@@ -7,7 +7,6 @@
 
 import org.gradle.api.internal.classpath.ModuleRegistry
 import org.gradle.api.tasks.testing.logging.TestExceptionFormat
-import org.gradle.configurationcache.extensions.serviceOf
 import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
 
 plugins {
@@ -49,13 +48,6 @@ dependencies {
 
   testImplementation(libs.junit)
 
-  testRuntimeOnly(
-      files(
-          serviceOf<ModuleRegistry>()
-              .getModule("gradle-tooling-api-builders")
-              .classpath
-              .asFiles
-              .first()))
 }
 
 // We intentionally don't build for Java 17 as users will see a cryptic bytecode version
System:
  OS: macOS 15.6.1
  CPU: (10) arm64 Apple M4
  Memory: 180.14 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 24.8.0
    path: /opt/homebrew/bin/node
  Yarn:
    version: 1.22.22
    path: /opt/homebrew/bin/yarn
  npm:
    version: 10.9.4
    path: ~/Synchronic-/node_modules/.bin/npm
  Watchman:
    version: 2025.09.15.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.16.2
    path: /opt/homebrew/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.5
      - iOS 18.5
      - macOS 15.5
      - tvOS 18.5
      - visionOS 2.5
      - watchOS 11.5
  Android SDK: Not Found
IDEs:
  Android Studio: 2025.1 AI-251.26094.121.2513.14007798
  Xcode:
    version: 16.4/16F6
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 21.0.7
    path: /usr/bin/javac
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.73.5
    wanted: 0.73.5
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: false

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs: AttentionIssues where the author has responded to feedback.Needs: ReproThis issue could be improved with a clear list of steps to reproduce the issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions