0

I've narrowed down the problem to overlapping dependencies within my project, however, I'm not sure which dependencies to exclude for my project to build properly. If I delete the ParseFacebookUtilsV3 files from my libs folder, then I get another DexException with a duplicate LBolts/AggregateException.

Here is my gradle.build file:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 21
    buildToolsVersion "21.1.2"

    defaultConfig {
        applicationId "kevts.washington.edu.fiternity"
        minSdkVersion 15
        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'
    compile 'com.facebook.android:facebook-android-sdk:4.0.0'
}

Here is the contents of my libs folder:

bolts-android-1.1.4.jar

bolts-android-1.1.4.jar.properties

bolts-android-1.1.4-javadoc.jar

Parse-1.9.0.jar

Parse-1.9.0.jar.properties

Parse-1.9.0-javadoc

ParseCrashReporting-1.9.0.jar

ParseCrashReporting-1.9.0.jar.properties

ParseCrashReporting-1.9.0-javadoc

ParseFacebookUtilsV3-1.9.0.jar

ParseFacebookUtilsV3-1.9.0.jar.properties

ParseFacebookUtilsV3-1.9.0-javadoc

ParseFacebookUtilsV4-1.9.0.jar

ParseFacebookUtilsV4-1.9.0.jar.properties

ParseFacebookUtilsV4-1.9.0-javadoc

third_party_licenses.txt

And here is the error I'm getting:

:app:preDexDebug UP-TO-DATE :app:dexDebug UNEXPECTED TOP-LEVEL EXCEPTION: com.android.dex.DexException: Multiple dex files define Lcom/parse/FacebookAuthenticationProvider$1; at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596) at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554) at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535) at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171) at com.android.dx.merge.DexMerger.merge(DexMerger.java:189) at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:454) at com.android.dx.command.dexer.Main.runMonoDex(Main.java:303) at com.android.dx.command.dexer.Main.run(Main.java:246) at com.android.dx.command.dexer.Main.main(Main.java:215) at com.android.dx.command.Main.main(Main.java:106) Error:Execution failed for task ':app:dexDebug'.

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 2

Thanks in advance.

1 Answers1

0

Add the following lines to your gradle

compile 'com.parse.bolts:bolts-android:1.+'
compile fileTree(dir: 'libs', include: 'Parse-*.jar')
Adarsh
  • 827
  • 9
  • 23
  • Adding these lines causes ParseFacebookUtils to not be recognized and it will still fail to build. – Kevin Tsang Apr 06 '15 at 09:03
  • In addition to your advice, I also added this line: compile fileTree(dir: 'libs', include: ['ParseFacebookUtilsV4-1.9.0.jar']) and my program was able to build. – Kevin Tsang Apr 06 '15 at 09:08
  • that depends if you have a separate jar for Facebook utils it will throw an error i had an all in one jar so there was no problem. – Adarsh Apr 06 '15 at 14:56