Ubuntu Jenkins 服务器 - 无法创建 Android 模拟器

Ubuntu Jenkins server - Could not create Android emulator

我有一个用于学习 Jenkins 的 VirtualBox,我正在尝试从我的 github 构建一个 Android 项目。构建失败并始终收到错误:

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

我已经尝试检查 jenkins 用户的权限和组成员资格,但 id 似乎没有做任何事情。

这里是 jenkins android 模拟器在 jenkins 中的配置:

这是我的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'
}

更新:

尝试运行 AVD 在终端中以我自己的用户身份手动创建并获得:

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

现在似乎没有 ABI,但我不能确定 jenkins 是否属于这种情况,因为可能有一些是针对 jenkins 而不是我的系统用户。

还在调查。

必须检查 jenkins 的 Android SDK 在哪里。

我假设这是我下载并存储在环境变量 ANDROID_HOME 中的 SDK。但是我使用了 Android Jenkins 插件,它下载并安装了自己的 android sdk 工具。

Jenkins 使用的是 /var/lib/jenkins/tools/android-sdk

通过查看控制台输出来检查这一点。我最终重新创建了我的服务器并只使用了插件。

另一个可行的选项是我的朋友创建了一个 AVD,然后将其提供给构建。