2

https://semaphoreci.com

I have an Android project I'm working on I'm trying to set up automated integration testing on every PR against my master branch on GitHub with semaphoreci.

The question I have is, how can I run the gradle tasks if there is no Android SDK? Do I have to push my Android SDK (really don't wanna)? Or can I point to a compiled Android SDK on a server (possibly Google)?

So far I have it set up semaphoreci to run these commands:

gradle wrapper // Fails here
./gradlew clean
./gradlew build

I get this error

FAILURE: Build failed with an exception.
[0K
* What went wrong:
A problem occurred configuring project ':app'.
> SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.
Pants
  • 2,563
  • 1
  • 20
  • 34

1 Answers1

0

I know this is an old topic, but I've recently set this up, myself and figured I'd post the solution here in case someone stumbles upon this post in the future and needs help.

The solution is to install the Android SDK command-line tools. Place the following in the commands: section of your Semaphore script. All of this below may not be strictly necessary, but it works for me when building my own React-Native Android app. Make sure you grab the latest version of the command-line toolset listed here: https://developer.android.com/studio#command-tools. On Semaphore, you want the Linux toolset. The first line of the script installs some suggested prerequisites before grabbing and installing the Android SDK CLI. Then just carry on with the rest of your commands to do whatever else you need to test/build your app.

- echo y | sudo apt-get install libc6-dev-i386 lib32z1 openjdk-8-
- wget https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip
- unzip sdk-tools-linux-4333796.zip
- export ANDROID_HOME=`pwd`
- yes | tools/bin/sdkmanager --update || exit 0
- yes | tools/bin/sdkmanager "platform-tools" "platforms;android-28" || exit 0
- yes | tools/bin/sdkmanager --licenses || exit 0
Joe Moore
  • 1
  • 2