我有两个库项目,几乎完全相同的build.gradle文件。这两个项目在依赖关系中都有support-library-v4,声明如下
dependencies {
compile 'com.android.support:support-v4:19.0.+'
}
并上传到nexus。问题如下:当我添加两个(一个库一切正常)库到主项目时抛出以下异常:
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)
据我了解命令
gradlew -q dependencies
未在support-library-v4
上显示任何冗余依赖项releaseApk - ## Internal use, do not manually configure ##
+--- com.commonsware.cwac:endless:1.2.4
+--- com.android.support:appcompat-v7:19.0.+ -> 19.0.1
| \--- com.android.support:support-v4:19.0.1
+--- com.squareup.retrofit:retrofit:1.3.0
| \--- com.google.code.gson:gson:2.2.4
+--- com.squareup.picasso:picasso:2.1.1
+--- com.google.code.gson:gson:2.2.4
+--- ru.vang:progressswitcher:1.1.2
\--- com.intech:android-commons:1.0.4
我正在使用Android Studio 0.5.1,gradle-1.11和最新的sdk。图书馆包装在一起并上传到Nexus。主项目中的依赖关系是
dependencies {
compile 'com.commonsware.cwac:endless:1.2.4'
compile 'com.android.support:appcompat-v7:19.0.+'
compile 'com.squareup.retrofit:retrofit:1.3.0'
compile 'com.squareup.picasso:picasso:2.1.1'
compile 'com.google.code.gson:gson:2.2.4'
compile('ru.vang:progressswitcher:1.1.2')
}
可能是什么问题?