gpt4 book ai didi

android - 多个dex文件定义Landroid/support/v13/app

转载 作者:行者123 更新时间:2023-11-29 01:42:58 27 4
gpt4 key购买 nike

我正在尝试在 Android Studio 中编译我的项目,但出现以下错误

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依赖

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 文件吗?到底是什么问题?

谢谢

最佳答案

我认为问题在于类“android.support.v13.app.FragmentCompat$FragmentCompatImpl”在依赖项中声明了两次。此类包含在以下两个依赖项中:

compile ('com.android.support:appcompat-v7:+'){
exclude module: 'support-v4'
}

compile "com.android.support:support-v13:+"

“support-v13”库已包含“appcompat-v7”库。

尝试从“build.gradle”文件中删除“appcompat-v7”库,它应该可以编译。

// *** remove this ****
compile ('com.android.support:appcompat-v7:+'){
exclude module: 'support-v4'
}

希望这对您有所帮助。

关于android - 多个dex文件定义Landroid/support/v13/app,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23278307/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com