多个dex文件在android studio中定义了Landroid/support/v4/

Multiple dex files define Landroid/support/v4/ in android studio(多个dex文件在android studio中定义了Landroid/support/v4/)
本文介绍了多个dex文件在android studio中定义了Landroid/support/v4/的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我可以与许多库集成(添加和工作).

但是对于 ActionBarSherlock 库,我有很多问题.

But as for ActionBarSherlock library, I have so many problems with it.

First Issue是热门issue多个dex文件定义

我知道 duplicated android-support-v4.jar 导致它,但我现在无法解决这个问题:

I know The duplicated android-support-v4.jar causes it, but I can not solve this issue now :

Error:Execution failed for task ':fitness:dexDebug'.

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: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)

我遵循了 同样的错误中的答案.它使用了:

I followed the answer in same error. It used :

dependencies {
    compile('...') {
      exclude module: 'support-v4'
    }

    compile 'com.android.support:support-v4:18.0.+'
}

但我收到了第二个问题:unsupported Gradle DSL method found: 'exclude()'! 错误.因此,我像这样更改了 main modulebuild.gradle:

But I received Second Issue : unsupported Gradle DSL method found: 'exclude()'! error. Therefore I changed build.gradle of main module like this:

//configurations {
//    all*.exclude group: 'com.android.support', module: 'support-v4'
/
                
本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Android release APK crash with java.lang.AssertionError: impossible in java.lang.Enum(Android 发布 APK 因 java.lang.AssertionError 崩溃:在 java.lang.Enum 中不可能)
Finished with Non Zero Exit Value 3(以非零退出值 3 结束)
On gradle:3.0.0 More than one file was found with OS independent path #39;META-INF/ASL2.0#39;(在 gradle:3.0.0 上找到多个文件,其独立于操作系统的路径为“META-INF/ASL2.0)
Android : app loading library at runtime on Lollipop but not IceCreamSandwich(Android:运行时在 Lollipop 上而不是 IceCreamSandwich 上的应用程序加载库)
buildConfigField depending on flavor + buildType(buildConfigField 取决于风味 + buildType)
How do I suppress warnings when compiling an android library with gradle?(使用 gradle 编译 android 库时如何抑制警告?)