0

I'm running android on a Bamboo server hosted on a Mac OS (Yosemite). I have set the path to android_sdk, both in bash_profile and in /etc/path. Checking that:

echo $ANDROID_HOME
> /Applications/Android/sdk

But when running the build I get the following error:

java.lang.RuntimeException: SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.

My problem is that this will be run from different type of machines, a linux and a MAC OS, so the path might vary. So defining a path in as an Environmental variable is not an alternative, since it might vary for the different operating system. I don't want to create separate builds for different machines.

I also haven't found any alternativ to set the variable as a capability for the bamboo agent, maybe there is?

Any suggestions how to solve this? Can I specify it in gradle somehow? Checking in local.properties is not an alternative.

peuhse
  • 1,688
  • 2
  • 20
  • 32

2 Answers2

1

In Creation of task for the plan, just provide the android sdk location (on CI server) in Environment variables. Check the screen shot attached, in my case it was placed at : "ANDROID_HOME="/Users/{your user}/Library/Android/sdkenter image description here"

Vinay
  • 203
  • 4
  • 7
0

I have heard before that if the problem has to do with Gradle, configuring the ANDROID_HOME maybe won't work. Here is a solution that is usually working for projects on Android Studio...

In your project's directory add a file named local.properties. Then add the following line in there:

sdk.dir=/Applications/Android/sdk

This file is usually created automatically generated by Android Studio. It also has the following comments in it:

This file is automatically generated by Android Studio.

Do not modify this file -- YOUR CHANGES WILL BE ERASED!

This file should NOT be checked into Version Control Systems, as it contains information specific to your local configuration.

Location of the SDK. This is only used by Gradle. For customization when using a Version Control System, please read the header note.

kostia
  • 324
  • 5
  • 18
  • I can't see how this can work if the path varies on different agent machines with different OS´s? – peuhse Aug 29 '16 at 15:19