Wednesday, May 13, 2015

:app:dexDebug Error During Gradle Build

Error:Execution failed for task ':app:dexDebug'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/bin/java'' finished with non-zero exit value 2


This is caused by duplicated dex files in one of the jar file.

The error message in this case is:

com.android.dex.DexException: Multiple dex files define Lcom/google/android/gms/analytics/internal/Command$1;


It turned out that Google updated their google play service, which conflicts with the Google Analytic Service.

So I changed the build file from

dependencies {
    compile 'com.android.support:support-v4:22.1.1'    compile 'com.google.android.gms:play-services:+'    compile files('libs/acra-4.5.0.jar')
    compile files('libs/jackson-annotations-2.2.2.jar')
    compile files('libs/jackson-core-2.2.2.jar')
    compile files('libs/jackson-databind-2.2.2.jar')
    compile files('libs/libGoogleAnalyticsServices-3.01.jar')
    compile('org.simpleframework:simple-xml:2.7.1') {
        exclude group: 'stax', module: 'stax-api'        exclude group: 'xpp3', module: 'xpp3'    }

To

compile 'com.google.android.gms:play-services:6.5.87'
Problem solved!

1 comment:

  1. What if the error is caused after adding Universal Image Loader jar reference?

    ReplyDelete