I want to create a build server for my Android Application. I am working with TeamCity. My problem is:
- Build server which is a PC (Windows) doesn't see Android SDK location.
- PC on which server runs has ANDROID_HOME set in right way.
- My application uses Gradle build system.
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?
- I used local.properties in my Android Project. I tried to set ANDROID_HOME parameter to sdk.dir in various ways for example.
sdk.dir = ANDROID_HOME
result - error:
The SDK directory 'E:\TeamCity\buildAgent\work\a6d423a9d6e29c40\ANDROID_HOME' does not exist.
So as you can see, server adds some strange directory before. Same goes for: $ANDROID_HOME or %ANDROID_HOME%.
- When I set path manually and point to SDK direction on server so:
sdk.dir = /Program Files (x86)/android-studio/sdk
Then server builds the project and everything is right. ANDROID_HOME environment variable is set to same location as this.
- I deleted local.properties and I get this:
SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.
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.)
How can I set environment variable in local.properties so I don't have to hardcode it to make it work?