java.lang.ClassNotFoundException: org.gradle.wrapper.GradleWrapperMain
Asked Answered
R

3

5

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?

Roadability answered 10/9, 2018 at 14:14 Comment(2)
run this gradle--stacktraceGaff
since I didn't install gradle that didn't workRoadability
R
11

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.

Roadability answered 11/9, 2018 at 8:12 Comment(1)
Not stupid at all, was trying to find a solution for hours, this way solved it in a minute, thanksGang
T
1

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.

Tavis answered 10/9, 2020 at 11:41 Comment(0)
P
0

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

Perrin answered 18/7, 2023 at 8:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.