Can not run gradlew on Windows 7 64bit


I have two project using Gradle. One is generated by IntelliJ IDE (projectA), the other is generated by Android Studio (projectB).

From projectA’s root directory, if I ran “gradlew” from a cygwin shell, everything works fine. But from the projectB’s root directory, when I ran “gradlew”, I got this error:

java.lang.NoClassDefFoundError: org/gradle/wrapper/GradleWrapperMain

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


at Method)


at java.lang.ClassLoader.loadClass(

at sun.misc.Launcher$AppClassLoader.loadClass(

at java.lang.ClassLoader.loadClass(

Could not find the main class: org.gradle.wrapper.GradleWrapperMain. Program will exit.

Exception in thread “main”

I checked the “gradle” directory and the scripts generated in each of the project’s, they looks all the same. I checked this forum as well, and there’re a lot issues with similar error output, but none of them can help me fix this problem.

Sounds like something might be wrong with the wrapper files installed for projectB.

But for projectB, if I build the project from Android Studio, everything works fine. I think Android Studio also uses Gradle, no?

Yes, but it doesn’t use the wrapper files (except for ‘’).

Ah~thanks. The .jar files are really different…Now, it works :slight_smile: