Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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!

like image 376
ranjjose Avatar asked Sep 19 '16 08:09

ranjjose


People also ask

How do I fix SDK location not found?

Close the current project and you'll see a pop-up with a dialog which will then proceed to Configure option. Configure -> Project Defaults -> Project Structure -> SDKs on left column -> Android SDK Home Path -> give the exact path as you did on local. properties and select Valid Target.

How do I fix Android SDK not found?

Quick fix: Go to the Tools –> SDK manager –> SDK tools. Deselect Hide obsolete packages option on the right bottom and further install Android SDK Tools(obsolete). A new folder named Tools is now generated in the SDK directory. (C:\Users\..

Where is my SDK location?

by default, the "Android Studio IDE" will be installed in " C:\Program Files\Android\Android Studio ", and the "Android SDK" in " c:\Users\username\AppData\Local\Android\Sdk ".

Can not find Android SDK folder?

If you have downloaded the AS + SDK bundle: Note #2: you will never find the SDK in the Android Studio directory unless you have explicitly put it in there. The reason is that those directories might be deleted after installing a newer version of Android Studio and you would have to re-install the SDK as well.


2 Answers

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

like image 135
ligi Avatar answered Oct 15 '22 03:10

ligi


In my situation, it happened because file

local.properties

had been added to .gitignore

(I assemble from remote)

like image 35
Andrew Avatar answered Oct 15 '22 02:10

Andrew