任务执行失败':app:dexDebug'

时间:2014-12-09 09:00:51

标签: android jar android-support-library build.gradle

这是我的gradle文件:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 20
    buildToolsVersion '20.0.0'

    defaultConfig {
        applicationId "com.nifty.eattime.eattime"
        minSdkVersion 15
        targetSdkVersion 20
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    packagingOptions {
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE-FIREBASE.txt'
        exclude 'META-INF/NOTICE'
    }

}
dependencies {
    compile files('libs/android-toq-api-1.5.2.jar')
    compile files('libs/firebase-client-android-2.0.3.jar')
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.google.android.gms:play-services:5.0.89'


}

我得到的错误是:

任务执行失败':app:dexDebug'。

  

com.android.ide.common.internal.LoggedErrorException:无法运行命令:       /Users/trungha/Documents/Projects/AndroidProject/android-sdk-macosx/build-tools/20.0.0/dx --dex --output / Users / trungha / Documents / Projects / CS160 / final_project / EatTime / app / build / intermediates / dex / debug / Users / trungha / Documents / Projects / CS160 / final_project / EatTime / app / build / intermediates / classes / debug / Users / trungha / Documents / Projects / CS160 / final_project / EatTime / app / build / intermediates / dependency-cache / debug /Users/trungha/Documents/Projects/CS160/final_project/EatTime/app/build/intermediates/pre-dexed/debug/android-toq-api-1.5.2-f889cb10fa3ffcf552ce25911647e19e8725882e.jar / Users / trungha /Documents/Projects/CS160/final_project/EatTime/app/build/intermediates/pre-dexed/debug/classes-058601ccc68d7ab3a25a4d7acfed330e991f63f0.jar / Users / trungha / Documents / Projects / CS160 / final_project / EatTime / app / build / intermediates / pre -dexed / debug / firebase-client-android-2.0.3-3c2b9f93968b42c99643d13191d90362745a12c2.jar / Users / trungha / Documents / Projects / CS160 / final_project / EatTime / app / build / intermediates / pre -dexed / debug / firebase-client-android-2.0.3-f7791b3ec0a8d11d755da5b7bca6b01657039ab3.jar / Users / trungha / Documents / Projects / CS160 / final_project / EatTime / app / build / intermediates / pre-dexed / debug / firebase-client-jvm -2.0.3-fc93a1dc76afe6f8e7657b91abe71118cd7dfb93.jar /Users/trungha/Documents/Projects/CS160/final_project/EatTime/app/build/intermediates/pre-dexed/debug/jackson-annotations-2.2.2-9aa6cf2cfd800b7f8182b30d7eec54bd95d6b744.jar / Users / trungha /Documents/Projects/CS160/final_project/EatTime/app/build/intermediates/pre-dexed/debug/jackson-core-2.2.2-1eb9bcfaba66967c860990f07408925462140191.jar / Users / trungha / Documents / Projects / CS160 / final_project / EatTime / app /build/intermediates/pre-dexed/debug/jackson-databind-2.2.2-5e8cbe8ca9e588d94b7577f0c6dd61ff811c42d9.jar / Users / trungha / Documents / Projects / CS160 / final_project / EatTime / app / build / intermediates / pre-dexed / debug / support -v4-19.1.0-eead7e08439b52f014b0470eef9256c4660aa428.jar / Users / trungha / Documents / Projects / CS160 / final_project / EatTime / app /build/intermediates/pre-dexed/debug/tubesock-0.0.10-abbab7705f143b8d0d20df128b78e7b91fbf41f5.jar     错误代码:       2     输出:

UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Lcom/firebase/client/android/AndroidCredentialStore;
    at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:594)
    at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:552)
    at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:533)
    at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:170)
    at com.android.dx.merge.DexMerger.merge(DexMerger.java:188)
    at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:439)
    at com.android.dx.command.dexer.Main.runMonoDex(Main.java:287)
    at com.android.dx.command.dexer.Main.run(Main.java:230)
    at com.android.dx.command.dexer.Main.main(Main.java:199)
    at com.android.dx.command.Main.main(Main.java:103)

根据我的阅读,它与重复的依赖关系有关。我试图排除com.android.support,但它不起作用。帮助将不胜感激。谢谢。

1 个答案:

答案 0 :(得分:2)

你应该删除

compile files('libs/android-toq-api-1.5.2.jar')
compile files('libs/firebase-client-android-2.0.3.jar')
compile 'com.google.android.gms:play-services:5.0.89'

只留下

compile fileTree(dir: 'libs', include: ['*.jar'])

我有同样的错误,我尝试了,之后我没有更多的错误。