我在尝试将 Android gradle 与 Jenkins Android Emulator插件集成时遇到了令人讨厌的问题。 我将这些属性设置为我的Android模拟器:
当我开始这个过程时,模拟器会出现属性,但是我收到以下错误:
[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.+'
}
我很感激您可以分享的任何帮助或提示。提前谢谢!
更新&溶液 :
我通过将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'
}