【问题标题】:Multiple Dex Files Exception in Android StudioAndroid Studio 中的多个 Dex 文件异常
【发布时间】:2014-03-18 14:11:37
【问题描述】:

突然间,我在 Android Studio 的项目中遇到以下错误。

Execution failed for task ':app:dexDebug'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
    /Applications/Android Studio.app/sdk/build-tools/android-4.4/dx --dex --output /Users/azamsharp/AndroidStudioProjects/SLB/app/build/dex/debug /Users/azamsharp/AndroidStudioProjects/SLB/app/build/classes/debug /Users/azamsharp/AndroidStudioProjects/SLB/app/build/dependency-cache/debug /Users/azamsharp/AndroidStudioProjects/SLB/app/build/pre-dexed/debug/android-async-http-1.4.4-ebbcd48910e41cec52d1452a5743c94a9159f5e1.jar /Users/azamsharp/AndroidStudioProjects/SLB/app/build/pre-dexed/debug/android-support-v4-6c3868a97cf3c20d5a1f7a32bd415e4ceb4d85e8.jar /Users/azamsharp/AndroidStudioProjects/SLB/app/build/pre-dexed/debug/classes-8df088fb881a9b300721edc9635f1f9db6ecf298.jar /Users/azamsharp/AndroidStudioProjects/SLB/app/build/pre-dexed/debug/gcm-dd10621f5a27ca99ec0a973a9d3d24df75dabba1.jar /Users/azamsharp/AndroidStudioProjects/SLB/app/build/pre-dexed/debug/support-v4-19.0.1-3bf117e59e2e0f41bbf9219f2be90cdcf1dd583d.jar
  Error Code:
    2
  Output:
    UNEXPECTED TOP-LEVEL EXCEPTION:
    com.android.dex.DexException: Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl;
        at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:593)
        at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:551)
        at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:532)
        at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:169)
        at com.android.dx.merge.DexMerger.merge(DexMerger.java:187)
        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)

我什至没有对引用做任何事情。我只是添加了一个活动,然后不久将其删除。

【问题讨论】:

  • 您是否将任何库项目添加到您的主项目中。
  • 不是最近!我是在 2-3 周前添加的。
  • 这就是困扰我的问题!我从 2 到 3 周开始运行这个项目。我添加了一个活动,然后我删除了该活动,然后这个问题开始出现。真奇怪!!!
  • 我注释掉了 // compile 'com.android.support:appcompat-v7:+' 而不是它编译和工作!
  • appcompat-v7 包含 support-v4,所以如果有前者,则不需要后者。

标签: android android-studio


【解决方案1】:

好的,我有同样的问题,这里是解决方案:

转到顶部的“构建”和“清理项目”以及“重建项目”之后 它帮助到我! 您也可以转到“文件”和“无效缓存”并重新启动 Android Studio

当然,请确保清单没问题,并且没有重复包含!

【讨论】:

    猜你喜欢
    • 2015-09-25
    • 2015-02-25
    • 2023-03-03
    • 1970-01-01
    • 1970-01-01
    • 2014-11-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多