Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jenkins android build failing with the message: FATAL: The Gradle wrapper has not been found in these directories

When I try building android project, build fails with the following msg:

Started by user admin
Building in workspace /Users/Shared/Jenkins/Home/workspace/stable-dev
[Gradle] - Launching build.

FATAL: The Gradle wrapper has not been found in these directories:   
/Users/admin/Downloads/android_stable_dev, 
/Users/Shared/Jenkins/Home/workspace/stable-dev

Build step 'Invoke Gradle script' marked build as failure
Finished: FAILURE

Configurations I used:

  1. Use Gradle Wrapper
  2. build File: /Users/admin/Downloads/android_stable_dev/build.gradle

I tried filling /Users/admin/Downloads/android_stable_dev/gradlew, /Users/admin/Downloads/android_stable_dev/gradle/wrapper/, /Users/admin/Downloads/android_stable_dev/gradle/ etc. in the Wrapper location field in the configuration. Still didn't work (All those files are there).

I'm using jenkins-2.47.pkg

like image 375
ranjjose Avatar asked Feb 23 '17 11:02

ranjjose


2 Answers

You only have to provide the location of parent folder of the gradlew and build.gradle and not the files. So in your case

Root Build script: /Users/admin/Downloads/android_stable_dev
Wrapper Location: /Users/admin/Downloads/android_stable_dev

It is mentioned in the help (click ? next to Wrapper Location and Root Build script options) but I too found this out after carefully reading it multiple times

like image 99
Piyush Khera Avatar answered Nov 03 '22 01:11

Piyush Khera


If you are not getting the correct file path in Jenkins of your gradle wrapper, you can set this using cd command and run the specific task like below.

cd ${WORKSPACE}/Android/YOUR_CODE_FOLDER
./gradlew clean assembleDebug
like image 43
Punit Sharma Avatar answered Nov 03 '22 01:11

Punit Sharma