Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/react-native/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
React native Gradle:无法初始化类org.codehaus.groovy.runtime.InvokerHelper_React Native_Android Studio_Gradle_React Native Android_Gradlew - Fatal编程技术网

React native Gradle:无法初始化类org.codehaus.groovy.runtime.InvokerHelper

React native Gradle:无法初始化类org.codehaus.groovy.runtime.InvokerHelper,react-native,android-studio,gradle,react-native-android,gradlew,React Native,Android Studio,Gradle,React Native Android,Gradlew,我看到了这个gradle错误:“无法初始化类org.codehaus.groovy.runtime.InvokerHelper”。我尝试了网上列出的多种方法来解决这个问题,但没有成功。 在调试过程中,我发现了奇怪的JVM版本 安装了Java14,我已经在bash_概要文件的Java_主页中设置了路径。然而,gradle显示了JVM13版本。我不确定这是否会导致错误:无法初始化类org.codehaus.groovy.runtime.InvokerHelper 我的java版本 java vers

我看到了这个gradle错误:“无法初始化类org.codehaus.groovy.runtime.InvokerHelper”。我尝试了网上列出的多种方法来解决这个问题,但没有成功。 在调试过程中,我发现了奇怪的JVM版本

安装了Java14,我已经在bash_概要文件的Java_主页中设置了路径。然而,gradle显示了JVM13版本。我不确定这是否会导致错误:无法初始化类org.codehaus.groovy.runtime.InvokerHelper

我的java版本

java version "14.0.1" 2020-04-14
Java(TM) SE Runtime Environment (build 14.0.1+7)
Java HotSpot(TM) 64-Bit Server VM (build 14.0.1+7, mixed mode, sharing)
Gradle版本,但不确定JVM为什么显示13

Gradle 6.5
------------------------------------------------------------

Build time:   2020-06-02 20:46:21 UTC
Revision:     a27f41e4ae5e8a41ab9b19f8dd6d86d7b384dad4

Kotlin:       1.3.72
Groovy:       2.5.11
Ant:          Apache Ant(TM) version 1.10.7 compiled on September 1 2019
JVM:          **13.0.2 (Oracle Corporation 13.0.2+8)**
OS:           Mac OS X 10.14.6 x86_64

梯度误差

npx react-native run-android
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 960 file(s) to forward-jetify. Using 4 workers...
info JS server already running.
info Launching emulator...
info Successfully launched emulator.
info Installing the app...

FAILURE: Build failed with an exception.

* What went wrong:
Could not initialize class org.codehaus.groovy.runtime.InvokerHelper

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 3s

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Run CLI with --verbose flag for more details.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081

FAILURE: Build failed with an exception.

* What went wrong:
Could not initialize class org.codehaus.groovy.runtime.InvokerHelper

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 3s
更改渐变的版本 在
YOUR_PROJECT/android/gradle/wrapper/gradle wrapper.properties
中编辑文件并更改版本

发件人:

分配=https://services.gradle.org/distributions/gradle-6.0.1-all.zip

致:

分配=https://services.gradle.org/distributions/gradle-6.4.1-all.zip


来源:

--debug
--stacktrace
添加到Gradle调用cmd以获取更多详细信息。我也遇到了同样的问题,这对我很有效。谢谢你,巴勃罗!事实上,你必须在你的系统中将其更改为当前安装的版本。兄弟,你是我的一天,我遇到了这个错误,并试图解决很多问题,但没有任何效果。这个解决方案对我有效。你也应该为我得到更多的感谢!非常感谢。这是我的工作,谢谢