本文介绍了错误,当我的gradle包含的图书馆的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我包括编译com.specyci:residemenu:1.6 +'在我的项目库。我有一个错误:

I include compile 'com.specyci:residemenu:1.6+' library in my project. And i Have an error :

Error:Execution failed for task ':app:dexDebug'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
    C:\Users\...\AppData\Local\Android\sdk\build-tools\22.0.0\dx.bat --dex --no-optimize --output C:\projects\android-customer\app\build\intermediates\dex\debug --input-list=C:\projects\android-customer\app\build\intermediates\tmp\dex\debug\inputList.txt
Error Code:
    2
Output:
    UNEXPECTED TOP-LEVEL EXCEPTION:
    com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536
        at com.android.dx.merge.DexMerger$6.updateIndex(DexMerger.java:502)
        at com.android.dx.merge.DexMerger$IdMerger.mergeSorted(DexMerger.java:277)
        at com.android.dx.merge.DexMerger.mergeMethodIds(DexMerger.java:491)
        at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:168)
        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)

我试过

packagingOptions {
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/inputList'
    }

但这没有帮助。我该如何解决这个问题?

but this not help. How do I fix this?

推荐答案

您有问题,此文件 C:\\项目\\ Android的客户\\程序\\编译\\中间体\\ tmp目录\\ DEX \\调试\\ inputList.txt ,可能有格式不匹配。尝试打开该文件,并再次重新保存。清洁后的项目。希望它帮助。

You have a problem with this file C:\projects\android-customer\app\build\intermediates\tmp\dex\debug\inputList.txt, possibly there is format mismatch. Try to open this file and resave it once again. Clean project after. Hope it helps.

更新

也尝试将它添加到你的摇篮

Try also add it to your Gradle

android {
    defaultConfig {
       ...
       multiDexEnabled = true
    }
}

Source

另一个link
和one详情

这篇关于错误,当我的gradle包含的图书馆的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-30 15:00