I am trying to build an apk via jenkins for my android application. I followed this tutorial to do this.The issue I have is my Android sdk is installed in a separate hard disk (Not the one where jenkins is installed).
So the path I set for the sdk in the environment variable is not identified by jenkins & the build fails. But I can build an apk normally using Android studio with the same sdk path.
P.S Android studio is installed in the same hard where jenkins is installed. I referred to this solution but still no luck. Also I cannot move the sdk to the disk where I have installed jenkins because of a disk space issue. Please can any one help me on this ?
Please refer to the console log in Jenkins
16:52:08 Started by user Darrel Rayen
16:52:08 Building in workspace /var/lib/jenkins/workspace/android-
recruiter-app
16:52:08 > git rev-parse --is-inside-work-tree # timeout=10
16:52:08 Fetching changes from the remote Git repository
16:52:08 > git config remote.origin.url
https://DarrelR@bitbucket.org/harver/android-recruiter-app.git #
timeout=10
16:52:08 Fetching upstream changes from
https://DarrelR@bitbucket.org/harver/android-recruiter-app.git
16:52:08 > git --version # timeout=10
16:52:08 using GIT_ASKPASS to set credentials
16:52:08 > git fetch --tags --progress
https://DarrelR@bitbucket.org/harver/android-recruiter-app.git
+refs/heads/*:refs/remotes/origin/*
16:52:12 > git rev-parse refs/remotes/origin/master^{commit} #
timeout=10
16:52:12 > git rev-parse refs/remotes/origin/origin/master^{commit} #
timeout=10
16:52:12 Checking out Revision
1609ea0ced1febf6a6cbb8bbd9488637c2c70e1a (refs/remotes/origin/master)
16:52:12 > git config core.sparsecheckout # timeout=10
16:52:12 > git checkout -f 1609ea0ced1febf6a6cbb8bbd9488637c2c70e1a
16:52:12 Commit message: "Merged in AMOB-264-end-to-end-testing-for-
the-cand (pull request #57)"
16:52:12 > git rev-list --no-walk
1609ea0ced1febf6a6cbb8bbd9488637c2c70e1a # timeout=10
16:52:12 [Gradle] - Launching build.
16:52:12 [android-recruiter-app] $ /var/lib/jenkins/workspace/android-
recruiter-app/gradlew clean assembleDebug test connectedAndroidTest
16:52:12 Starting a Gradle Daemon (subsequent builds will be faster)
16:52:16
16:52:16 FAILURE: Build failed with an exception.
16:52:16
16:52:16 * What went wrong:
16:52:16 A problem occurred configuring project ':app'.
16:52:16 > The SDK directory '/media/darrel/NewDisk' does not exist.
16:52:16
16:52:16 * Try:
16:52:16 Run with --stacktrace option to get the stack trace. Run with
--info or --debug option to get more log output. Run with --scan to
get full insights.
16:52:16
16:52:16 * Get more help at https://help.gradle.org
16:52:16
16:52:16 BUILD FAILED in 4s
16:52:16 Build step 'Invoke Gradle script' changed build result to
FAILURE
16:52:16 Build step 'Invoke Gradle script' marked build as failure
16:52:17 Finished: FAILURE