简体   繁体   中英

How to resolve java.lang.ClassNotFoundException: org.gradle.wrapper.GradleWrapperMain error?

we are trying to deploy code to a FRC robot with VScode, but we keep getting the error:

Error: Could not find or load main class
org.gradle.wrapper.GradleWrapperMain
Caused by: java.lang.ClassNotFoundException:
org.gradle.wrapper.GradleWrapperMain
The terminal process terminated with exit code: 1

we have found that other people have also gotten similar errors, but none of their solutions have helped us. We would really appreciate any help resolving this error Thanks

I assume you are using the Gradle wrapper script ( gradlew on the command line). This script relies on two other files:

gradle/wrapper/gradle-wrapper.jar
gradle/wrapper/gradle-wrapper.properties

My guess is that the jar file is missing or corrupt. You can try regenerating them by downloading Gradle manually and then running gradle wrapper (note the missing 'w') in the same folder. If this is code you are maintaining in a version control repository (eg Git), make sure to add and commit these two files to the repository.

Was there any recent modifications to the project files? I too faced the same issue after I deleted the entire project unknowingly (shift+delete) and recovered it but somehow the gradlew command wasnt working ( got same error as what you've got). I checked the project folder at below location and was able to see that the gradle-wrapper.jar file was showing 0kb size.

\\gradle\\wrapper

So i replaced it with correct gradlew jar file and I was able to execute the command without any issues. Might help someone some day! peace :)

EDIT 1: Assuming the above issue is in android studio

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