Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: Could not find or load main class org.gradle.wrapper.GradleWrapperMain

My build.gradle for an Android app has become quite lengthy. Chanced upon this plugin called gradle-lint-plugin and configured it properly. In its documentation it says

Run ./gradlew fixGradleLint to automatically fix your build scripts

but upon running that I get Error: Could not find or load main class org.gradle.wrapper.GradleWrapperMain.

Does this have anything to do with the Android Studio using its own Gradle plugin? I do not have Gradle installed systemwide.

Edit: I do not wish to install Gradle systemwide - is there any way to do this within Android Studio only?

like image 665
hongsy Avatar asked Jul 21 '16 15:07

hongsy


2 Answers

Sounds like the wrapper is not setup correctly. Likely missing the wrapper jar.

$ ls gradle/wrapper
gradle-wrapper.jar        gradle-wrapper.properties

When you look in gradle/wrapper do you see gradle-wrapper.jar?

if you install gradle you can generate the jar with this command: $ gradle wrapper

like image 194
JBirdVegas Avatar answered Sep 28 '22 17:09

JBirdVegas


I was having this error and I solved it correcting the path which had special caracters.

Ex: .../T&G/appmobile to ../TG/appmobile

like image 37
Thiago Henrique Gomes Brandão Avatar answered Sep 28 '22 17:09

Thiago Henrique Gomes Brandão