Skip to content

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

Snoy-Kuo edited this page Mar 21, 2022 · 1 revision

Messages

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

Description

The project's output apk can be generated locally by command ./gradlew assembleRelease. When it goes to Jenkins, the gralew task ran to fail with 'Could not find or load main class org.gradle.wrapper.GradleWrapperMain.' error message.

Dev env

  • macOS 11.6 (Big Sur) x64
  • Android Studio Bumblebee Patch 1
  • Android SDK version 27
  • buildTool: 28.0.3
  • Android Gradle Plugin: 3.3.3
  • Gradle: 4.10.3
  • Gradle JDK: corretto-1.8
  • Kotlin: 1.3.72
  • Jenkins: 2.190.2

Tried approaches

Solutions

  • Be sure these four files pushed to remote repo: gradle-wrapper.jar, gradle-wrapper.properties, gradlew, gradlew.bat
    • Check remote repo, if they are not there, check .gitignore file again. In my case, I have ignored /gradle/, gradlew, and gradlew.bat