Jenkins giving The SDK Directory doesn't exist
<p>I'm trying to setup continuous integration with <code>Jenkins</code> on an <code>android</code> <code>gradle</code> project</p>

<p>When I build it, I get the following error:</p>

<pre><code>[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.
</code></pre>

<p>The following is part of my jenkins configuration:</p>

<pre><code>ANDROID_HOME
/Users/chaz/Library/Android/sdk

JAVA_HOME
/Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Contents/Home/
</code></pre>

<p>My machine is <code>OS X El Capitan Version 10.11.6</code></p>

<p>I have tried the following:</p>

<ol>
<li>Thinking it is a permission issue, gave chmod -R 777 for the sdk directory</li>
<li>Double checked the <code>sdk.dir</code> in <code>local.properties</code> file (It is pointing to <code>/Users/chaz/Library/Android/sdk</code>).</li>
<li>Removed added back <code>ANDROID_HOME</code> env variable from within jenkins configuration (didn't help).</li>
</ol>

<p>When I googled, I found someone faced the same <a href="https://groups.google.com/forum/#!topic/jenkinsci-users/Y2lYvFrpqa0" rel="noreferrer">issue</a>. And the solution provided was as follows:</p>

<p>Solution</p>

<blockquote>
  <p>That's most likely happening because you're overriding ANDROID_HOME — 
  remove environment customisations like that and then the SDK should 
  install fine. </p>
</blockquote>

<p>Acknowledgement</p>

<blockquote>
  <p>Thanks and yeah, it was overlapping of env variables. I have removed all except the global one and kept it in ${ANDROID_HOME}.</p>
</blockquote>

<p>How should I do the <strong><em>all except the global one and kept it in ${ANDROID_HOME}.</em></strong> part of the solution?</p>

<p><strong>Edit:</strong> 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).  </p>

<p>Thanks in advance!</p>