ANDROID_HOME not installed (VSTS agent runs as a service on OS X)

I set up the VSTS agent on my MacBook Pro, and it works fine when I run it manually (using ./run.sh).

However, when I configure the VSTS agent to start as a service (using ./svc.sh installand ./svc.sh start) and queue a new assembly in VSTS, I get an error (at the signing stage) "ANDROID_HOME not set".

I have the following settings in my .bash_profile:

export ANDROID_HOME=/Users/$(whoami)/Library/Android/sdk
export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools

The path is correct, and also works echo $ANDROID_HOMEreturns the expected value (in this case /Users/mvanbeusekom/Library/Android/sdk).

Does anyone know what could be wrong?

+4
source share
1 answer

Your agent’s folder contains a file called runvc.sh. Add the export there. You will see a commented line with a hint about where you want to set your env setting:

# insert anything to setup env when running as a service
export ANDROID_HOME=/Users/$(whoami)/Library/Android/sdk

Be sure to restart the service.

The reason .bash_profiledoes not work for you, because the service does not have access to it when it starts.

I had the same problem and found a solution here: https://github.com/Microsoft/vsts-tasks/issues/1726#issuecomment-219725321

For those who develop Xamarin, you usually need this:

# insert anything to setup env when running as a service
export ANDROID_HOME=/Users/$(whoami)/Library/Developer/Xamarin/android-sdk-macosx
+8
source

All Articles