多DEX文件定义Landroid /支持/ V13 /应用 [英] Multiple dex files define Landroid/support/v13/app
问题描述
我试图编译我的Android Studio中的项目,我碰到下面的错误
I am trying to compile my project in Android Studio and I get the following error
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Landroid/support/v13/app/FragmentCompat$FragmentCompatImpl;
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)
运行
$ gradle -q dependencies
产生以下结果。
compile - Classpath for compiling the main sources.
+--- project :facebookSDK
+--- project :stripe
+--- project :paymentKitLibrary
+--- com.google.code.gson:gson:2.2.4
+--- com.google.android.gms:play-services:4.3.23
+--- com.android.support:appcompat-v7:+ -> 19.1.0
+--- com.squareup.picasso:picasso:2.2.0
+--- com.loopj.android:android-async-http:1.4.4
\--- com.android.support:support-v13:+ -> 19.1.0
\--- com.android.support:support-v4:19.1.0
下面是我依赖的gradle
Here are my gradle dependencies
dependencies {
compile project(':facebookSDK')
compile project(':stripe')
compile project(':paymentKitLibrary')
compile 'com.google.code.gson:gson:2.2.4'
compile ('com.google.android.gms:play-services:4.3.23'){
exclude module: 'support-v4'
}
compile ('com.android.support:appcompat-v7:+'){
exclude module: 'support-v4'
}
compile 'com.squareup.picasso:picasso:2.2.0'
compile 'com.loopj.android:android-async-http:1.4.4'
compile "com.android.support:support-v13:+"
compile files('libs/crashlytics.jar')
compile files('libs/libGoogleAnalyticsV2.jar')
compile files('libs/MobileAppTracker.jar')
compile files('libs/twitter4j-core-3.0.5.jar')
}
我不明白的地方冲突的来源。是否有可能将其从jar文件的一个未来?这是什么问题呢?
I do not understand where the conflict is coming from. Is it possible it is coming from one of the jar files ? What is the problem anyway ?
感谢
推荐答案
我认为问题是出类android.support.v13.app.FragmentCompat $ FragmentCompatImpl在声明的依赖两次。这个类是包含在以下两个依赖:
I think the problem is that the class "android.support.v13.app.FragmentCompat$FragmentCompatImpl" is declared twice in the dependencies. This class is included in both of the following dependencies:
compile ('com.android.support:appcompat-v7:+'){
exclude module: 'support-v4'
}
compile "com.android.support:support-v13:+"
支持-V13库中已经包含了应用程序兼容性-V7库中。
The "support-v13" library already contains the "appcompat-v7" library.
尝试从你的的build.gradle文件中删除程序兼容性-V7库,它应该编译。
Try removing the "appcompat-v7" library from your "build.gradle" file and it should compile.
// *** remove this ****
compile ('com.android.support:appcompat-v7:+'){
exclude module: 'support-v4'
}
希望这有助于。
这篇关于多DEX文件定义Landroid /支持/ V13 /应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!