使用AndroidStudio时候导入开源项目ImageLoader lib包时,出现错误
Error:Execution failed for task ':app:dexDebug'. > com.android.ide.common.internal.LoggedErrorException: Failed to run command: E:\android_studio\sdk_studio\android-sdk-windows\build-tools\21.1.1\dx.bat --dex --no-optimize --output F:\github_workspace\DailyTest\app\build\intermediates\dex\debug --input-list=F:\github_workspace\DailyTest\app\build\intermediates\tmp\dex\debug\inputList.txt 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:596) at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554) at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535) at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171) at com.android.dx.merge.DexMerger.merge(DexMerger.java:189) at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:454) at com.android.dx.command.dexer.Main.runMonoDex(Main.java:302) at com.android.dx.command.dexer.Main.run(Main.java:245) at com.android.dx.command.dexer.Main.main(Main.java:214) at com.android.dx.command.Main.main(Main.java:106)
解决如下:在app的 build.gradle中添加所有support包
configurations { all*.exclude group: 'com.android.support', module: 'support-v4'
是由于并不是只有一个扩展项目 导入support-4,需要统一管理。