2

I am building an Android Application using CircleCI, and within the project I compile an Android Library as a dependency. However, I get the following error during the CircleCI build:

A problem occurred configuring project ':aModule'.
> The SDK directory '/home/myname/Android/Sdk' does not exist.

It looks like CircleCI is attempting to use some build tools to compile the module, but fails because it is using an absolute path on my machine. How would I configure CircleCI to use a local path of the Android SDK, if possible?

Here is my build.gradle as well, if necessary:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 24
    buildToolsVersion "24.0.0"

    defaultConfig {
        applicationId "com.myapp.app"
        minSdkVersion 16
        targetSdkVersion 24
        versionCode 1
        versionName "0.1"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'),     'proguard-rules.pro'
        }
    }
}

repositories {
    maven {
        url "http://dl.bintray.com/glomadrian/maven"
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    wearApp project(':wear')
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:24.0.0'
    compile 'com.android.support:cardview-v7:24.0.0'
    compile 'com.github.medyo:fancybuttons:1.8.1'
    compile 'com.github.glomadrian:roadrunner:1.0@aar'
    compile 'com.afollestad.material-dialogs:core:0.8.6.1'
    compile 'pl.droidsonroids.gif:android-gif-drawable:1.1.16'
    compile 'com.android.support:design:24.0.0'
    compile 'com.github.PhilJay:MPAndroidChart:v3.0.0-beta1'
    compile 'joda-time:joda-time:2.9.4'
    compile project(':aModule')
}

* Update: The SDK path is set in my project's local.properties

vontell
  • 342
  • 3
  • 17

1 Answers1

0

for me the solution was to use the following in a circle.yml file

#
# Build configuration for Circle CI
#

general:
    artifacts:
        - /home/ubuntu/your-app-name/app/build/outputs/apk/

machine:
  environment:
    ANDROID_HOME: /usr/local/android-sdk-linux
    GRADLE_OPTS: '-Dorg.gradle.jvmargs="-Xmx2048m -XX:+HeapDumpOnOutOfMemoryError"'
  java:
    version: oraclejdk8

checkout:
  post:
    - git submodule sync
    - git submodule update --init

dependencies:
    pre:
        - echo y | android update sdk --no-ui --all --filter tools,platform-tools,build-tools-25.0.2,android-25,extra-google-m2repository,extra-google-google_play_services,extra-android-m2repository,extra-android-support
        - chmod +x gradlew
        - ANDROID_HOME=/usr/local/android-sdk-linux ./gradlew dependencies

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

permission for gradlew and setting ANDROID_HOME=/usr/local/android-sdk-linux seemed to be what was needed...

but I have been using circleci for about 30 minutes...

CrandellWS
  • 2,708
  • 5
  • 49
  • 111