执行失败的任务“:应用程序:dexDebug” [英] Execution failed for task':app:dexDebug'

查看:462
本文介绍了执行失败的任务“:应用程序:dexDebug”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的build.gradle文件。

This is my build.gradle file.

apply plugin: 'com.android.application'

android {
    compileSdkVersion 20
    buildToolsVersion "20.0.0"

defaultConfig {
    applicationId "com.squad.run"
    minSdkVersion 10
    targetSdkVersion 19
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }
}

buildTypes {
    release {
        runProguard false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
    }
}
}

dependencies {
    compile project(':facebookSDK')
    compile project(':library')
    compile project(':progressHUD_Squadrun')
    compile project(':pullToRefreshLibrary_Squadrun')
    compile project(':slidingMenuLibrary_SquadRun')
    compile project(':viewPagerIndicator_Squadrun')
    compile 'com.android.support:support-v4:20.0.0'
    compile 'com.google.code.gson:gson:2.2.4'
    compile 'com.google.android.gms:play-services:+'
    compile ('com.android.support:appcompat-v7:+')
    compile 'com.squareup.retrofit:retrofit:1.6.1'
    compile 'com.squareup.picasso:picasso:2.3.4'
    compile 'org.apache.httpcomponents:httpmime:4.2.3'
    compile 'com.squareup.okhttp:okhttp:1.5.4'
    compile 'oauth.signpost:signpost-commonshttp4:1.2.1.2'
    compile 'org.twitter4j:twitter4j-core:4.0.1'
    compile files('libs/FlurryAnalytics-4.1.0.jar')
    compile files('libs/signpost-core-1.2.1.2.jar')
}
configurations.all {
    resolutionStrategy {
        force 'com.android.support:support-v4:20.+'
        force 'com.android.support:appcompat-v7:20.+'

    }
}

我得到的错误是:

The error i am getting is:

Error:Execution failed for task ':splashActivity:dexDebug'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
    C:\Program Files (x86)\Android\android-studio\sdk\build-tools\android-4.4W\dx.bat --dex --num-threads=4 --output C:\Users\Jonty\Documents\Studio\squadrunapp_duplicate\splashActivity\build\intermediates\dex\debug C:\Users\Jonty\Documents\Studio\squadrunapp_duplicate\splashActivity\build\intermediates\classes\debug C:\Users\Jonty\Documents\Studio\squadrunapp_duplicate\splashActivity\build\intermediates\dependency-cache\debug C:\Users\Jonty\Documents\Studio\squadrunapp_duplicate\splashActivity\build\intermediates\pre-dexed\debug\bolts-a453c67e9fbcb8b2df66a807f07597b525fb5510.jar C:\Users\Jonty\Documents\Studio\squadrunapp_duplicate\splashActivity\build\intermediates\pre-dexed\debug\classes-0995d8d31789d692af9771bc79994535d0e9a11a.jar C:\Users\Jonty\Documents\Studio\squadrunapp_duplicate\splashActivity\build\intermediates\pre-dexed\debug\classes-82cb9af78535d442f7254cfacf8e5581ec7f198f.jar C:\Users\Jonty\Documents\Studio\squadrunapp_duplicate\splashActivity\build\intermediates\pre-dexed\debug\classes-89329bbc6b94e906573340292603af66cd64cb4e.jar C:\Users\Jonty\Documents\Studio\squadrunapp_duplicate\splashActivity\build\intermediates\pre-dexed\debug\classes-9ae85e5dda6ac87e5fea9eef10579046127f64ec.jar C:\Users\Jonty\Documents\Studio\squadrunapp_duplicate\splashActivity\build\intermediates\pre-dexed\debug\classes-9e0a0926f1bf743e60be55256fecd3044b3fb3a3.jar C:\Users\Jonty\Documents\Studio\squadrunapp_duplicate\splashActivity\build\intermediates\pre-dexed\debug\classes-db2d588e091d9f00bcf352380664bcea0550c2db.jar C:\Users\Jonty\Documents\Studio\squadrunapp_duplicate\splashActivity\build\intermediates\pre-dexed\debug\classes-e47e7de01366f4c982a9621611d5b51065b46b4c.jar C:\Users\Jonty\Documents\Studio\squadrunapp_duplicate\splashActivity\build\intermediates\pre-dexed\debug\classes-e5a017caf8243b588c7668187fffdb443d97efa3.jar C:\Users\Jonty\Documents\Studio\squadrunapp_duplicate\splashActivity\build\intermediates\pre-dexed\debug\classes-edb407f320a9d16ab253cdece9f7de0c9849dee4.jar C:\Users\Jonty\Documents\Studio\squadrunapp_duplicate\splashActivity\build\intermediates\pre-dexed\debug\commons-codec-1.3-744613167a0498e87bddefe11d9715a6a77d814c.jar C:\Users\Jonty\Documents\Studio\squadrunapp_duplicate\splashActivity\build\intermediates\pre-dexed\debug\FlurryAnalytics-4.1.0-3e22e246a0fe5113ab006ccb53afd17722686ba5.jar C:\Users\Jonty\Documents\Studio\squadrunapp_duplicate\splashActivity\build\intermediates\pre-dexed\debug\gson-2.2.4-09611e369a15fd5115f540570c544bb969143206.jar C:\Users\Jonty\Documents\Studio\squadrunapp_duplicate\splashActivity\build\intermediates\pre-dexed\debug\httpcore-4.2.2-6d4bd90cc9c601d0cb426d3b6f13e630051be2ab.jar C:\Users\Jonty\Documents\Studio\squadrunapp_duplicate\splashActivity\build\intermediates\pre-dexed\debug\httpmime-4.2.3-114981e5b1ca0603b19d0c173b834fb4f36dc7b3.jar C:\Users\Jonty\Documents\Studio\squadrunapp_duplicate\splashActivity\build\intermediates\pre-dexed\debug\internal_impl-20.0.0-4d4a1b5904ea596662a1d75090720f4a71528c3c.jar C:\Users\Jonty\Documents\Studio\squadrunapp_duplicate\splashActivity\build\intermediates\pre-dexed\debug\nineoldandroids-2.4.0-c15291f1a5d73b9ed06c48806c179c177c2c9326.jar C:\Users\Jonty\Documents\Studio\squadrunapp_duplicate\splashActivity\build\intermediates\pre-dexed\debug\okhttp-1.5.4-1d4d39f1325704b750ebee0aa6d60f57eca82163.jar C:\Users\Jonty\Documents\Studio\squadrunapp_duplicate\splashActivity\build\intermediates\pre-dexed\debug\picasso-2.3.4-825d3c0d5a3645c39e62902f73d0b2e5dbc2f221.jar C:\Users\Jonty\Documents\Studio\squadrunapp_duplicate\splashActivity\build\intermediates\pre-dexed\debug\retrofit-1.6.1-7a2bce6e9943b126155a7444b7c6abd4fb80e2cb.jar C:\Users\Jonty\Documents\Studio\squadrunapp_duplicate\splashActivity\build\intermediates\pre-dexed\debug\signpost-commonshttp4-1.2.1.2-457264617652896d5137504440ed9fd54533c9c3.jar C:\Users\Jonty\Documents\Studio\squadrunapp_duplicate\splashActivity\build\intermediates\pre-dexed\debug\signpost-core-1.2.1.2-114c53ef70d732d013001aa342ae8e81962fb26c.jar C:\Users\Jonty\Documents\Studio\squadrunapp_duplicate\splashActivity\build\intermediates\pre-dexed\debug\signpost-core-1.2.1.2-4824b5b475ceb675ff2174e6d7caf3756ba2af4a.jar C:\Users\Jonty\Documents\Studio\squadrunapp_duplicate\splashActivity\build\intermediates\pre-dexed\debug\support-annotations-20.0.0-79e42da7c2657068d681cf877be8b4cc06e3cb7a.jar C:\Users\Jonty\Documents\Studio\squadrunapp_duplicate\splashActivity\build\intermediates\pre-dexed\debug\twitter4j-core-4.0.1-1e2ff826eb1ee2df67db1f0634f99a7220b788a7.jar
Error Code:
    2
Output:
    UNEXPECTED TOP-LEVEL EXCEPTION:
    com.android.dex.DexException: Multiple dex files define Lcom/google/gdata/util/common/base/Escaper;
        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)

从我读到现在我得到的错误是由于V4库和V7 library.But之间的冲突如何解决它。我也试图排除V4库,但仍然没有运气。
我正在导入也正在使用V4库和项目有V4库的依赖。

From what i read till now i get the error is due to conflict between V4 library and V7 library.But how can i resolve it.I also tried excluding the V4 library but still no luck. The projects i am importing are also using the V4 library and have V4 library in their dependency.

dependencies {
     compile 'com.android.support:support-v4:20.0.0'
}

任何帮助将AP preciated。
谢谢你。

Any help will be appreciated. Thanks.

推荐答案

这不是V4支持和V7-应用程序兼容性之间的冲突,虽然这是真的,如果你有后者则不需要前者。它在抱怨重复的类不从那里来的呢。你应该能够找出是否在Android的工作室你去浏览>类和类型的逃避者,你应该能够看到,它定义了多个库。

It's not a clash between v4-support and v7-appcompat, though it's true that if you have the latter you don't need the former. The duplicate class it's complaining about doesn't come from there anyway. You should be able to find out if in Android Studio you go to Navigate > Class and type in Escaper, you should be able to see the multiple libraries that define it.

我做了,我只包括了从项目中所引用下载依赖从jcenter包括,我可以看到,这个库的副本拉一个示例项目:

I made a sample project where I included just the includes from your project that referenced downloadable dependencies from jcenter, and I can see that this library pulls in a copy of it:

compile 'oauth.signpost:signpost-commonshttp4:1.2.1.2'

虽然它通过一个路标,核心1.2.1.2.jar文件即将英寸如果我看POM文件为该库(<一个href=\"http://search.maven.org/remotecontent?filepath=oauth/signpost/signpost-commonshttp4/1.2.1.2/signpost-commonshttp4-1.2.1.2.pom\" rel=\"nofollow\">http://search.maven.org/remotecontent?filepath=oauth/signpost/signpost-commonshttp4/1.2.1.2/signpost-commonshttp4-1.2.1.2.pom)我可以看到,它已经在路标型抽芯作为传递依赖:

though it's coming in via a signpost-core-1.2.1.2.jar file. If I look at the pom file for that library (http://search.maven.org/remotecontent?filepath=oauth/signpost/signpost-commonshttp4/1.2.1.2/signpost-commonshttp4-1.2.1.2.pom) I can see that it's already pulling in signpost-core as a transitive dependency:

<dependencies>
    <dependency>
        <groupId>oauth.signpost</groupId>
        <artifactId>signpost-core</artifactId>
        <version>${project.version}</version>
        <scope>compile</scope>
    </dependency>

在构建文件之后,您包括此作为一项明确的jar文件,这就是冗余的来源。通过包括路标-commonshttp,它应该是不必要的,以包括路标芯

Later on in your build file, you include this as an explicit jar file, which is where the redundancy is coming from. By including signpost-commonshttp, it should be unnecessary to include signpost-core.

路标不应该在全部重新分配这些文件,顺便说一句 - 这看起来像在图书馆包装误差

signpost shouldn't be redistributing these files at all, by the way -- this looks like a packaging error in the library.

请注意编译系统往往能避免冗余文件的问题,如果一切使用下载库,而不是明确的jar文件。假如你通过包括这个路标核心:

Note that the build system is often able to avoid problems with redundant files if everything uses downloadable libraries instead of explicit jar files. Had you included signpost-core via this:

compile 'oauth.signpost:signpost-core:1.2.1.2'

而不是直接包括它的jar文件,你就不会看到这个问题。

instead of including its jar file directly, you wouldn't have seen this problem.

一旦你清理这个问题,你会遇到其他问题。 httpmime使用Android提供的文件版本相冲突,而这个库可能是多余的,但你可以穿越下次桥梁。

Once you clear up this problem you'll run into other issues. httpmime clashes with versions of those files provided by Android, and this library may be redundant, but you can cross that bridge next.

这篇关于执行失败的任务“:应用程序:dexDebug”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆