Reputation: 2148
I'm trying to setup continuous integration with Jenkins
on an android
gradle
project
When I build it, I get the following error:
[Android Gradle Jenkins Experiment2] $ "/Users/Shared/Jenkins/Home/workspace/Android Gradle Jenkins Experiment2/gradlew" build
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
The SDK directory '/Users/chaz/Library/Android/sdk' does not exist.
The following is part of my jenkins configuration:
ANDROID_HOME
/Users/chaz/Library/Android/sdk
JAVA_HOME
/Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Contents/Home/
My machine is OS X El Capitan Version 10.11.6
I have tried the following:
sdk.dir
in local.properties
file (It is pointing to /Users/chaz/Library/Android/sdk
).ANDROID_HOME
env variable from within jenkins configuration (didn't help).When I googled, I found someone faced the same issue. And the solution provided was as follows:
Solution
That's most likely happening because you're overriding ANDROID_HOME — remove environment customisations like that and then the SDK should install fine.
Acknowledgement
Thanks and yeah, it was overlapping of env variables. I have removed all except the global one and kept it in ${ANDROID_HOME}.
How should I do the all except the global one and kept it in ${ANDROID_HOME}. part of the solution?
Edit: I was successfully able to use Jenkins on a windows machine with same jenkins configuration (I was able to build successfully, install apk in a device too).
Thanks in advance!
Upvotes: 16
Views: 9786
Reputation: 113
Go to Jenkins > Manage Jenkins > Configure System
Check "Environment variables"
add name: ANDROID_HOME, value -> the full path to your android sdk e.g /Users/{username}/Library/Android/sdk
click apply then save and retry build
Upvotes: 0
Reputation: 271
I have had the same issue, found next solution: remove ANDROID_HOME in Jenkins environment variables.
Upvotes: 0
Reputation: 21
I just want to say how we fixed this problem in our project. It may help someone.
The working directory of our Jenkins is under "/User/shared", and our SDK is under "/User/foo"
We tried to give user foo and everyone permission to the SDK folder and its parent folders, but it did not work.
Then we installed SDK under /user/Shared/Jenkins/Library/Android/SDK via Android SDK Manager, and gave user foo and everyone permission to the new SDK folder and its parent folders. Also, we changed the SDK Path to new in Jenkins project configuration. Then it works.
Upvotes: 2
Reputation: 38029
In my situation, it happened because file
local.properties
had been added to .gitignore
(I assemble from remote)
Upvotes: 3
Reputation: 11
As said by @ligi it's due to permission problem. So it can be fixed by 2 ways
Run below commands in ~/Library/ path by using terminal
chmod 777
at /Users/username/Library/
. Check permission by execute ls -s
command
So /Users/username/Library/
should now show the permission like this:
drwxr-xr-x@
Second way, run below command on Terminal to unhide library inside File explorer
chflags nohidden ~/Library/
So now navigate & right click on Library folder -> Get info -> Scroll down -> change permission on permission in dialog
Now run jerkin, it should be able to access the sdk directory inside Library
Upvotes: 1
Reputation: 39539
This smells like a permission problem. You might have given permission to the sdk-dir but not the parent directory.
Upvotes: 19