我试图将 Android gradleJenkins Android Emulator Plugin 集成时遇到了令人讨厌的问题 . 我将这些属性设置为我的Android模拟器:

  • Android操作系统版本:android-18

  • 屏幕密度:160

  • 屏幕分辨率:HVGA

  • 设备区域设置:es_ES

  • 目标ABI:armeabi-v7a

  • 仿真器名称后缀:android18

当我启动该过程时,模拟器启动属性,但我收到以下错误:

[Gradle] - Launching build.
[workspace] $ /var/lib/jenkins/jobs/properati-android/workspace/gradlew clean assemble
FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugCompile'.
   > Could not find com.android.support:support-v4:20.0.0.
     Required by:
         workspace:app:unspecified

在Gradle插件设置中(在Jenkins上作为命令行任务)我正在使用 gradlew clean assemble 命令来构建

以下是我目前在项目中使用的 build.gradle 文件 .

1)主要的gradle文件

projects/modules.

buildscript {

    repositories {
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:0.12.2'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

configurations {
    all*.exclude group: 'com.android.support', module: 'support-v4'
}

2)Project Gradle文件

apply plugin: 'com.android.application'

android {
    compileSdkVersion 20
    buildToolsVersion '20.0.0'

    defaultConfig {
        applicationId "com.example.app"
        minSdkVersion 9
        targetSdkVersion 20
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:support-v4:20.0.0'
    compile 'com.googlecode.android-query:android-query:0.25.9'
    compile 'com.github.castorflex.smoothprogressbar:library:0.5.2'
}

buildscript {
    repositories {
        mavenCentral()
    }

    dependencies {
        classpath 'com.newrelic.agent.android:agent-gradle-plugin:3.+'
    }
}

repositories {
    mavenCentral()
}

    apply plugin: 'android'
    apply plugin: 'newrelic'

dependencies {
    compile 'com.newrelic.agent.android:android-agent:3.+'
}

如果您有任何帮助或提示,我将不胜感激 . 提前致谢!

UPDATE & Solution

我通过将AndroidSupportV4.jar添加到我的libs文件夹并将build.gradle文件更改为以下内容来解决此问题:

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    //compile 'com.android.support:support-v4:20.0.0' --OLD LINE
    compile files ("libs/AndroidSupportV4.jar")        --NEW LINE
    compile 'com.googlecode.android-query:android-query:0.25.9'
    compile 'com.github.castorflex.smoothprogressbar:library:0.5.2'
}