Reputation: 12915
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?
Upvotes: 5
Views: 7626
Reputation: 1
you have to change distribution url in gradle-warper.properties file to updated version like below
**distributionUrl=https://services.gradle.org/distributions/gradle-7.5.1-all.zip
Upvotes: 0
Reputation: 789
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.
Upvotes: 1
Reputation: 12915
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.
Upvotes: 11