Android Studio 运行出现 Multiple dex files define Landroid/support/annotation/AnimRes;解决方法

问题描述

Error:Execution failed for task ':app:dexDebug'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
	E:\DevResources\sdk\build-tools\21.1.2\dx.bat --dex --no-optimize --output E:\AS_Workspace\FutureCity\app\build\intermediates\dex\debug --input-list=E:\AS_Workspace\FutureCity\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/annotation/AnimRes;
		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:303)
		at com.android.dx.command.dexer.Main.run(Main.java:246)
		at com.android.dx.command.dexer.Main.main(Main.java:215)
		at com.android.dx.command.Main.main(Main.java:106)

看到这个问题第一眼感觉是support-v4和v7的jar包引起的冲突。

项目依赖了一个google play service的library,上google-play的libs下面找了半天也没看见v7的影子。

后来F12查看module属性才发现,尼玛

Android Studio 运行出现 Multiple dex files define Landroid/support/annotation/AnimRes;解决方法_第1张图片

问题找到了,就好解决了,把项目中v4支持包删掉,果然还是maven没用好啊!

你可能感兴趣的:(android,Google,service,play,Studio,V4,V7)