简体   繁体   中英

Error Could not initialize class org.codehaus.groovy.runtime.InvokerHelper

So i download some challenge edutools and after i run the challenge, i get error, i was install jdk java, sdk java, kotlin sdk, and gradle why i can get error i use, java jdk version

openjdk version "13.0.2" 2020-01-14

OpenJDK Runtime Environment (build 13.0.2+8)

OpenJDK 64-Bit Server VM (build 13.0.2+8, mixed mode, sharing)

and i use gradle version 6.2.2

Gradle 6.2.2

and this is full output of my gradle version

毕业版本

and this is my full output of error on my intelejit idea

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 1s

If I read https://github.com/gradle/gradle/issues/10248 correctly, this is an incompatibility with some Gradle versions and some JVM versions. I had a similar issue with Android SDK. You basically have two options:

  1. Downgrade your JVM to eg 1.8 - or install an alternative JVM
  2. Upgrade Gradle to >= 6.5

In my case, I set the JVM version to 1.8 and it worked flawlessly afterwards.

JetBrains Academy projects work on Java 11. Java 13 is not supported yet .

Please make sure that JDK 11 is selected in 中选择了 JDK 11 .

Also, ensure that the project has JDK 11 selected as Project SDK in .

You can download OpenJDK 11 from here .

I was getting the same error when using either Mac(macOS Big Sur) and Ubuntu(20.04 LTS) and I was able to resolve it by doing the following:

Go to /android/gradle/wrapper/gradle-wrapper.properties file in your RN project. Find the line that starts with distributionUrl and change the gradle version into gradle-6.4.1-all.zip .

FROM:

distributionUrl=https://services.gradle.org/distributions/gradle- 5.4.1 -all.zip

TO:

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

See sample illustration below:

RN-gradle-wrapper

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM