SDK location not found

android

#1

Hello,

I’m trying to to start using CI for my mobil apps projects, so I am new to this thing. The problem here is that when I’m testing the Android projects, I got the following error:

> Configuring > 1/4 projects > :app> Configuring > 2/4 projects
> Configuring > 2/4 projectsFAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> Failed to notify project evaluation listener.
   > SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.
   > SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

My circle.yml file contents looks like this:

## Customize the test machine
machine:
  environment:
    ANDROID_TARGET: android-23
    ADB_INSTALL_TIMEOUT: 12
    ANDROID_HOME: /usr/local/android-sdk-linux

  java:
    version: oraclejdk8


## Customize checkout
checkout:
  post:
    - git submodule sync
    - git submodule update --init # use submodules

## Customize dependencies
dependencies:
  pre:
    # workaround for "failed to find Build Tools revision xx"
    # https://discuss.circleci.com/t/android-build-tools-23-0-2-not-available/455/3
    - echo y | android update sdk --no-ui --all --filter platform-tools,tools,extra-android-m2repository,extra-google-m2repository,android-23
    - echo y | android update sdk --no-ui --all --filter build-tools-23.0.3

  override:
    - sudo ./gradlew dependencies

#2

I solved using the following:

- sudo ANDROID_HOME=/usr/local/android-sdk-linux ./gradlew dependencies

#3