Android and Jenkings using Gradle
I have an annoying problem trying to integrate Android gradle with Jenkins Android Emulator Plugin . I have set these properties to my android emulator:
- Android OS version: android-18
- Screen density: 160
- Screen resolution: HVGA
- Device language: es_ES
- ABI target: armeabi-v7a
- Emulator name suffix: android18
When I start the process, the emulator starts correctly, but I get the following error:
[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
In Gradle plugin settings (on Jenkins in Task command line) I am using gradlew clean assembly command to build
Below are the build.gradle files that I am using in my project.
1) Main Gradle file
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) Gradle project file
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.+'
}
I would appreciate any help or advice you could share. Thanks in advance!
UPDATE and solution :
I solved this problem by adding AndroidSupportV4.jar to my libs folder and changing my build.gradle file to this:
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'
}
+3
source to share
No one has answered this question yet
Check out similar questions: