title: Android SDK location vs Build Server, how to set it?
body: <p>I want to create a build server for my Android Application. I am working with TeamCity. My problem is:</p>
  
  <ol>
  <li>Build server which is a PC (Windows) doesn't see Android SDK location.</li>
  <li>PC on which server runs has ANDROID_HOME set in right way.</li>
  <li>My application uses Gradle build system.</li>
  </ol>
  
  <p>What I need to do is to make my build server use environment location (ANDROID_HOME) during build of my app. What have I already tried?</p>
  
  <ul>
  <li>I used local.properties in my Android Project. I tried to set ANDROID_HOME parameter to sdk.dir in various ways for example.</li>
  </ul>
  
  <blockquote>
    <p>sdk.dir = ANDROID_HOME</p>
  </blockquote>
  
  <p>result - error:</p>
  
  <blockquote>
    <p>The SDK directory 'E:\TeamCity\buildAgent\work\a6d423a9d6e29c40\ANDROID_HOME' does not exist.</p>
  </blockquote>
  
  <p>So as you can see, server adds some strange directory before. Same goes for: $ANDROID_HOME or %ANDROID_HOME%.</p>
  
  <ul>
  <li>When I set path manually and point to SDK direction on server so:</li>
  </ul>
  
  <blockquote>
    <p>sdk.dir = /Program Files (x86)/android-studio/sdk</p>
  </blockquote>
  
  <p>Then server builds the project and everything is right. ANDROID_HOME environment variable is set to same location as this.</p>
  
  <ul>
  <li>I deleted local.properties and I get this:</li>
  </ul>
  
  <blockquote>
    <p>SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.</p>
  </blockquote>
  
  <p>So how I understand this is: if I won't have local.properties in my project it will look for SDK path in ANDROID_HOME environment variable. Like I said, on my server environment variable is set and I've checked it many times. It doesn't work. (I tried it also on MAC X OS, terminal displays ANDROID_HOME as /Applications/Android Studio.app/sdk but for example Android Studio is able to build project only if I hardcode path in local.properties. It doesn't want to accept ANDROID_HOME variable in any way.)</p>
  
  <hr>
  
  <p>How can I set environment variable in local.properties so I don't have to hardcode it to make it work?</p>