skip to Main Content

e: /node_modules/@react-native/gradle-plugin/build.gradle.kts:10:49: Cannot access ‘serviceOf’: it is internal in ‘org.gradle.configurationcache.extensions’
e: /node_modules/@react-native/gradle-plugin/build.gradle.kts:45:11: Unresolved reference. None of the following candidates is applicable because of receiver type mismatch:
internal inline fun TaskInternal.serviceOf(): TypeVariable(T) defined in org.gradle.configurationcache.extensions

Build file ‘/node_modules/@react-native/gradle-plugin/build.gradle.kts’ line: 10

Script compilation errors:

  • Try:
    Run with –info or –debug option to get more log output. Run with –scan to get full insights.

  • Exception is:
    ScriptCompilationException(errors=[ScriptCompilationError(message=Cannot access ‘serviceOf’: it is internal in ‘org.gradle.configurationcache.extensions’, location=/private/var/folders/mt/lt1qt3y93g9gfsyl2vg6qkq00000gn/T/gradle-kotlin-dsl-10130061735515911946.tmp/build.gradle.kts (10:49)), ScriptCompilationError(message=Unresolved reference. None of the following candidates is applicable because of receiver type mismatch:
    internal inline fun TaskInternal.serviceOf(): TypeVariable(T) defined in org.gradle.configurationcache.extensions, location=/private/var/folders/mt/lt1qt3y93g9gfsyl2vg6qkq00000gn/T/gradle-kotlin-dsl-10130061735515911946.tmp/build.gradle.kts (45:11))])

react-native 0.72.5
gradle 8.0.1
node V20
jdk 11

2

Answers


  1. Same problem here! I already try remove the import org.gradle.configurationcache.extensions.serviceOf, but doesn’t work!

    Login or Signup to reply.
  2. I encountered the same issue having:

    React 18.3.1
    React Native 0.75.2
    npm 10.8.3
    openjdk 17.0.11 2024-04-16
    OpenJDK Runtime Environment (build 17.0.11+0--11852314)
    OpenJDK 64-Bit Server VM (build 17.0.11+0--11852314, mixed mode)
    Gradle 8.10
    Kotlin 1.9.24
    Groovy 3.0.22
    

    and I get in my project with command

    gradle --refresh-dependencies --full-stacktrace --debug --scan
    

    this error:

    2024-08-29T16:12:42.745+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] FAILURE: Build completed with 2 failures.
    2024-08-29T16:12:42.754+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 
    2024-08-29T16:12:42.754+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 1: Task failed with an exception.
    2024-08-29T16:12:42.754+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] -----------
    2024-08-29T16:12:42.754+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Where:
    2024-08-29T16:12:42.754+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Build file 'C:Users.....node_modules@react-nativegradle-pluginreact-native-gradle-pluginbuild.gradle.kts' line: 10
    2024-08-29T16:12:42.755+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 
    2024-08-29T16:12:42.755+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * What went wrong:
    2024-08-29T16:12:42.755+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Script compilation errors:
    2024-08-29T16:12:42.755+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 
    2024-08-29T16:12:42.755+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   Line 10: import org.gradle.configurationcache.extensions.serviceOf
    2024-08-29T16:12:42.755+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]                                                            ^ Unresolved reference: serviceOf
    2024-08-29T16:12:42.755+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 
    2024-08-29T16:12:42.755+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]   Line 58:           serviceOf<ModuleRegistry>()
    2024-08-29T16:12:42.755+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]                      ^ Unresolved reference: serviceOf
    2024-08-29T16:12:42.755+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 
    2024-08-29T16:12:42.755+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 2 errors
    2024-08-29T16:12:42.756+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 
    2024-08-29T16:12:42.756+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Try:
    2024-08-29T16:12:42.757+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > Run with --scan to get full insights.
    2024-08-29T16:12:42.757+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > Get more help at https://help.gradle.org.
    2024-08-29T16:12:42.760+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
    

    even in this issue on GitHub ( https://github.com/facebook/react-native/issues/32858 ) , they said it was resolved just changing version of Gradle but I just found it happens even with latest Gradle, 8.10.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search