Problem with ANDROID_HOME


#1

Hi All,

I am in the process of setting up circleci for my Android project hosted on GitHub.

I created .circleci/config.yml, pushed it to Github and trying to execute the build.

However, I am getting the following error:

FAILURE: Build failed with an exception.

  • 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.

My config.yml contains:

Build configuration for Circle CI

general:
artifacts:
- /home/ubuntu/DaggerAndroidScopesSampleApp/app/build/outputs/apk/

machine:
environment:
ANDROID_HOME: /usr/local/android-sdk-linux
ANDROID_BUILD_TOOLS: 26.0.1

dependencies:
override:
- echo y | android update sdk --no-ui --all --filter tools,platform-tools,build-tools-26.0.1,android-26,extra-google-m2repository,extra-google-google_play_services,extra-android-support
- ANDROID_HOME=/usr/local/android-sdk-linux ./gradlew dependencies

test:
override:
- (./gradlew assemble):
timeout: 360


#2

Just wondering–do any of these posts ever get read, or responded to, by CircleCI folks?

I have the same problem with 2.0. In 1.0, ANDROID_HOME was just there. In 2.0, I add the docker image android-25-beta, but see no ANDROID-HOME, nor /usr/local/android-sdk-linux` directory. I guess this is because the build plans run in the first docker image specified.

Using machine with circleci:classic does not give me the ANDROID_HOME environment variable, nor can I find the SDK anywhere obvious.

The 2.0 docs are silent on this issue.


#3

To solve the issue, I had to replace my config.yml with the one from https://circleci.com/docs/2.0/language-android/


#4