关于React Native报Cannot access ‘serviceOf‘的解决方案

Posted xiangzhihong8

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了关于React Native报Cannot access ‘serviceOf‘的解决方案相关的知识,希望对你有一定的参考价值。

最近,使用0.68.0版本的React Native构建项目后,在运行项目的时候,突然给报了一个Cannot access \'serviceOf\': it is internal in \'org.gradle.configurationcache.extensions\' 的错误,报错日志如下。

e: /Users/avishay/project/node_modules/react-native/packages/react-native-gradle-plugin/build.gradle.kts:9:49: Cannot access \'serviceOf\': it is internal in \'org.gradle.configurationcache.extensions\'
e: /Users/avishay/project/node_modules/react-native/packages/react-native-gradle-plugin/build.gradle.kts:41:7: Unresolved reference. None of the following candidates is applicable because of receiver type mismatch: 
internal inline fun <reified T : Any> TaskInternal.serviceOf(): TypeVariable(T) defined in org.gradle.configurationcache.extensions

下面是使用npx react-native info

info Fetching system and libraries information...
System:
    OS: macOS 11.6
    CPU: (8) x64 Intel(R) Core(TM) i7-1068NG7 CPU @ 

以上是关于关于React Native报Cannot access ‘serviceOf‘的解决方案的主要内容,如果未能解决你的问题,请参考以下文章

react-native-picke Cannot read property '_init' of undefined

关于React Native Android打包报Duplicate resources错的解决方法

关于React Native使用formData形式上传文件失败,请求失败报错:Net Error问题

React-Native添加依赖包后出现Native module cannot be null!的解决办法

React Native出现"Native module cannot be null"问题

使用 Jest 和 @testing-library/react-native 测试 React Native 项目时出现“SyntaxError: Cannot use import stateme