Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
445 views
in Technique[技术] by (71.8m points)

android - Jenkins giving The SDK Directory doesn't exist

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:

  1. Thinking it is a permission issue, gave chmod -R 777 for the sdk directory
  2. Double checked the sdk.dir in local.properties file (It is pointing to /Users/chaz/Library/Android/sdk).
  3. Removed added back 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!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

This smells like a permission problem. You might have given permission to the sdk-dir but not the parent directory.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...