0

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'
    }
User10
  • 27
  • 5
  • Are you shure you used the search function before? http://stackoverflow.com/questions/28429546/how-to-fix-this-gradle-appdexdebug-error Regards – sehe May 17 '16 at 12:57
  • I know the same libraries are meant to be the same version but how am I able to define the version of 'com.android.support:design' to match 'com.android.support:appcompat'? You are not able to simply put 'com.android.support:design-v7', so therefore I am looking for assistance as I am new to this development. – User10 May 17 '16 at 13:11

2 Answers2

1

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
}
Harshad Pansuriya
  • 20,189
  • 8
  • 67
  • 95
1

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'

NezSpencer
  • 640
  • 8
  • 12