Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

java.lang.ClassNotFoundException: org.gradle.wrapper.GradleWrapperMain

I just import an existing android project and wanted to run a gradle task from terminal.

But however I'm always getting following exception for this project:

java.lang.ClassNotFoundException: org.gradle.wrapper.GradleWrapperMain

I saw already several answers to the same problem, but they don't really help me.

Just to be sure my Android Studio is working right, I tried to open another project. There everything worked fine. And on the first look all settings of the project are the same.

I didn't installed gradle on my mac but using default gradle wrapper of the android studio instead.

Maybe any of you have a solution?

like image 979
Tima Avatar asked Dec 23 '22 04:12

Tima


2 Answers

A really stupid thing, but ... maybe it helpes someone else.

The gradle wrapper folder I've got didn't contain gradle-wrapper.jar

I'm not sure it's a right solution, but I added it manually from another project and now it works.

like image 104
Tima Avatar answered May 11 '23 10:05

Tima


In case nothing else helps, for a similar issue I cleaned up (i.e. deleted) the folders .gradle\caches and .gradle\wrapper\dists. Seems like something was broken in there.

My original error message was "java.lang.ClassNotFoundException: worker.org.gradle.process.internal.worker.GradleWorkerMain" when trying to run the gradle wrapper.

like image 29
evandor Avatar answered May 11 '23 11:05

evandor