Reputation: 391
My project can't compile with these libs:
My gradle code:
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com...."
minSdkVersion 9
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
}
Error:
**Error:Execution failed for task ':app:preDexDebug'.
com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/usr/lib/jvm/java-7-openjdk-amd64/bin/java'' finished with non-zero exit value 1**
Upvotes: 3
Views: 5492
Reputation: 1
this error from Android Studio seems to occur when there are library files in our app/libs folder which are not yet included in the gradle build. user1468102's answer worked for me. I've emptied my libs folder and everything went well
Please this link as well for adding libraries to a project and with gradle
Upvotes: 0
Reputation: 327
The Android plugin for Gradle available in Android SDK Build Tools 21.1 and higher supports multidex, so you have to add multiDexEnabled true
to your gradle file like this :
android {
compileSdkVersion 21
buildToolsVersion "21.1.0"
defaultConfig {
...
minSdkVersion 14
targetSdkVersion 21
...
// Enabling multidex support.
multiDexEnabled true
}
...
}
..
Upvotes: 1
Reputation: 2691
Seems to be a problem with your library. Try to update it and use
compile 'com.android.support:appcompat-v7:22.0.0'
Upvotes: 0