Search code examples
androidjenkinsjenkins-pluginsandroid-sdk-toolsandroid-sdk-2.3

Ubuntu Jenkins server - Could not create Android emulator


I have a VirtualBox that I am using to learn Jenkins on and I am trying to have an Android project built from my github. The build fails and always receives the error:

 [android] Could not create Android emulator: Failed to run AVD creation command

I have tried checking permissions and group membership for the jenkins user and id does not seem to do anything.

Here is the jenkins android emulator config in jenkins: enter image description here

Here is my build.gradle :

apply plugin: 'com.android.application'

android {
    compileSdkVersion 24
    buildToolsVersion "24.0.1"

    defaultConfig {
        applicationId "com.example.kylecalica_steinhil.howlit"
        minSdkVersion 15
        targetSdkVersion 24
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:24.1.1'
    compile 'com.squareup.retrofit:retrofit:1.9.0'
}

UPDATE:

tried running AVD creation as my own user in the terminal by hand and getting:

VALID ABIs: no ABIs.
Error: Invalid --abi armebi-v7a for the selected target. 

now it seems like there are no ABIs but I cannot be certain if this is the case for jenkins as there may be some for jenkins and not for my system user.

looking into it still.


Solution

  • Had to check where the Android SDK for jenkins was.

    I was assuming that it was the SDK I had downloaded and stored in my environment variable ANDROID_HOME. However I used the Android Jenkins Plugin which downloaded and installed its own android sdk tools.

    Instead Jenkins was using /var/lib/jenkins/tools/android-sdk

    Checked this by looking in console output. I ended up recreating my server and using just the plugin.

    Another option that worked was that my friend had created an AVD and then provide it to the build.