Gradle wrapper main class Java Origin: Application & API Last updated 15 Oct 2026

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

The Gradle wrapper JAR (gradle/wrapper/gradle-wrapper.jar) is missing or corrupt.

Exact message you may see Could not find or load main class org.gradle.wrapper.GradleWrapperMain
Seen on: Java

Meaning

gradlew needs gradle-wrapper.jar. It’s often excluded by .gitignore (*.jar) or not committed, so fresh clones and CI fail.

Common causes

  • gradle-wrapper.jar not committed (ignored by *.jar)
  • Corrupted download
  • Running gradlew from the wrong directory

⚡ Quick fix

  1. Regenerate: gradle wrapper (with a local Gradle)
  2. Commit gradle/wrapper/gradle-wrapper.jar and add a .gitignore exception

Detailed fix by platform

Java

  1. .gitignore: !gradle/wrapper/gradle-wrapper.jar

How to diagnose

  1. File — Does gradle/wrapper/gradle-wrapper.jar exist?
  2. Recent change — Did it start after a deploy, upgrade, or configuration change? Compare with the last working version.

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: Application & API. Errors that are often confused with or caused by this one (click to open):

Android resource linking failed — AAPT: error: resource x (aka y) not found — Android resource linking failed (Android)Android resource link…android:attr/lStar not found — AAPT: error: resource android:attr/lStar not found (Android)android:attr/lStar no…Cannot fit requested classes in a single dex file — Cannot fit requested classes in a single dex file (# methods: 65536 > 65536) — mergeDex failed (Android)Cannot fit requested …ClassNotFoundException — java.lang.ClassNotFoundException / NoClassDefFoundError (Java)ClassNotFoundExceptionCOPY failed — COPY failed: file not found in build context / "/app/x": not found (Docker)COPY failedCould not resolve — Gradle: Could not resolve all files for configuration / Could not resolve dependency (Android)Could not resolveDuplicate class — Duplicate class X found in modules A and B (Android)Duplicate classELIFECYCLE — npm ERR! code ELIFECYCLE / Command failed with exit code 1 (npm)ELIFECYCLEGradle wr…

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.