I need to see my dependencies in Gradle to fix a problem with multiple SLF4J bindings.
However, when I run 'gradle dependencies' I get the error:
Could not initialize class org.codehaus.groovy.runtime.InvokerHelper
In a similar question in stack-overflow Android Studio Could not initialize class org.codehaus.groovy.runtime.InvokerHelper
it was recommended to
I changed the jdk to 14 in IntelliJ in 2 places:
I attempted to update gradle from the command line with: 'gradle wrapper --gradle-version 6.3' and got the same error:
Could not initialize class org.codehaus.groovy.runtime.InvokerHelper
I then changed the field 'distributionUrl' in the file 'gradle-wrapper.properties' to 'gradle-6.3', as instructed here https://github.com/gradle/gradle/issues/10248.
I tried various combinations of jdk and gradle versions but nothing seems to work.
The Wrapper shell script and batch file reside in the root directory of a single or multi-project Gradle build. You will need to reference the correct path to those files in case you want to execute the build from a subproject directory e.g. ../../gradlew tasks .
Verify Gradle Installation. Now open the command prompt. In the command prompt, enter Gradle -version. It will display the current version of Gradle just installed on the screen.
This error is caused due to incompatible JAVA JDK and Gradle version in the project. Head to ./android/gradle/wrapper/gradle-properties ..... and change the required gradle version.
You can do that by going to {project root folder}\android\gradle\wrapper\gradle-wrapper.properties and changing the distributionUrl value to upgrade the Gradle version. You can check out here the lastest releases of Gradle. " The image is just to show where the text is written in the docs.
This means that there is another version of Groovy already known to the classloader, but this version doesn't have the method InvokerHelper. Check the Glassfish Doc on how to prefer the libs deployed with the application over existing libs of the same name.
This means that there is another version of Groovy already known to the classloader, but this version doesn't have the method InvokerHelper. Check the Glassfish Doc on how to prefer the libs deployed with the application over existing libs of the same name. The jar should be in the runtime classpath of the server.
So from your repo, if you have gradle-wrapper.properties like this:
➜ cat gradle/wrapper/gradle-wrapper.properties
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
On first compilation, Gradle tells you that:
build file '/Users/tim/Code/Java/brobotREST/build.gradle': 36:
all buildscript {} blocks must appear before any plugins {} blocks in the script
So if you move the buildscript
section up to the top of the build.gradle file, it all seems to work
And I get:
➜ ./gradlew -version
------------------------------------------------------------
Gradle 6.3
------------------------------------------------------------
Build time: 2020-03-24 19:52:07 UTC
Revision: bacd40b727b0130eeac8855ae3f9fd9a0b207c60
Kotlin: 1.3.70
Groovy: 2.5.10
Ant: Apache Ant(TM) version 1.10.7 compiled on September 1 2019
JVM: 14 (Azul Systems, Inc. 14+36)
OS: Mac OS X 10.15.4 x86_64
Had a similar problem on Windows 10 caused by a java version issue. In build.gradle set the java source compatibility flag; For java 1.8 this is
sourceCompatibility = '1.8'
then check the system version is the same
java -version
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With