如果我从命令行运行gradle assembleDebug
,则会突然收到此错误:
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dx.util.DexException: Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl;
at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:592)
at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:550)
at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:531)
at com.android.dx.merge.DexMerger.mergeDexBuffers(DexMerger.java:168)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:186)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:300)
at com.android.dx.command.dexer.Main.run(Main.java:232)
at com.android.dx.command.dexer.Main.main(Main.java:174)
at com.android.dx.command.Main.main(Main.java:91)
如果我为v4使用grep,则在build文件夹中看到两个文件。
Binary file build/pre-dexed/debug/support-v4-19.0.0-2ba5fdd60a6c3836b3104a863fe42897da1fa9d1.jar matches
Binary file build/pre-dexed/debug/support-v4-r7-227d905d79b23b20866531d4f700446c040a2ccb.jar matches
我的gradle文件仅包含以下支持库:
compile 'com.android.support:support-v13:19.0.0'
我对如何以某种方式包含r7库感到困惑。我已经运行了gradle clean
,当我重新运行assembleDebug时,它总是出现在那。
如果我在构建目录中grep r7,我会在文件中看到它:
Binary file build/exploded-bundles/ComGoogleAndroidGmsPlayServices4030.aar/classes.jar matches
如果我不包括v13,则其他内容将无法编译。
但是v13不包括v4支持库吗?
这是Play服务AAR捆绑包与v13库之间的不兼容吗?
我从gradleplease.appspot.com抓取了gradle文件。
删除播放服务不能解决该问题;同样的错误。
我在build.gradle中的依赖项:
dependencies {
// Google Play Services
//compile 'com.google.android.gms:play-services:4.0.30'
// Support Libraries
//compile 'com.android.support:support-v4:19.0.0'
///compile 'com.android.support:appcompat-v7:19.0.0'
//compile 'com.android.support:gridlayout-v7:19.0.0'
compile 'com.android.support:support-v13:19.0.0'
compile 'org.eclipse.mylyn.github:org.eclipse.egit.github.core:2.1.5'
compile 'commons-codec:commons-codec:1.9'
compile 'com.madgag:markdownj-core:0.4.1'
compile 'com.wu-man:android-oauth-client:0.0.2'
compile 'com.google.http-client:google-http-client-jackson2:1.17.0-rc'
compile 'org.apache.commons:commons-lang3:3.2'
compile 'com.google.code.gson:gson:2.2.4'
}