Reputation: 27
I am receiving the app:dexDebug error when trying to run my project on Android Studio. I believe it's got to do with my dependencies but I am not sure where I am going wrong.
The error is:
Error:Execution failed for task ':app:dexDebug'.
com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.7.0_17\bin\java.exe'' finished with non-zero exit value 2
My dependencies in the build.gradle file are as follows:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.2.1'
compile 'com.android.support:design:23.2.1'
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
compile 'com.google.android.gms:play-services:8.3.0'
compile 'org.springframework.android:spring-android-rest-template:1.0.1.RELEASE'
compile 'com.fasterxml.jackson.core:jackson-databind:2.3.2'
}
Can anyone point me in the correct direction here, please.
Thank you.
UPDATE
Problem solved by adding the following to my build.gradle
packagingOptions {
exclude 'META-INF/license.txt'
exclude 'META-INF/LICENSE'
exclude 'META-INF/notice.txt'
exclude 'META-INF/NOTICE'
}
Upvotes: 0
Views: 70
Reputation: 680
The problem is most likely caused by adding all play services dependencies. You should not compile the entire package of APIs into your app, it increases the number of methods in your app. app:dexDebug error indicates you have exceeded the 65k method limit. Remove this line in your build.gradle: compile 'com.google.android.gms:play-services:8.3.0'
then choose from these seperate dependencies, the ones to add based on what your app needs. E.g to use Gcm, you only need to add compile 'com.google.android.gms:play-services-gcm:8.4.0'
Upvotes: 1
Reputation: 20990
Android Studio Error:Execution failed for task ':app:dexDebug'
to solve it setting multiDexEnabled
to true
in your gradle file.
defaultConfig {
// Enabling multidex support.
multiDexEnabled true
}
Upvotes: 1