我是android开发的新手,在androidstudio中导入项目时 错误:
Error:Execution failed for task ':app:dexDebug'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
E:\android\adt-bundle-windows-x86_64-20140321\sdk\build-tools\21.1.2\dx.bat --dex --no-optimize --
output E:\android\CFPEvents\Gradleprojectcfp-android- user\app\build\intermediates\dex\debug --input-list=E:\android\CFPEvents\Gradleprojectcfp-android-user\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/AccessibilityServiceInfoCompatIcs;
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)
inputList.txt文件:
E:\android\CFPEvents\Gradleprojectcfp-android-user\app\build\intermediates\classes\debug
E:\android\CFPEvents\Gradleprojectcfp-android- user\app\build\intermediates\pre-dexed\debug\support-annotations-20.0.0- 22f67c0dddc9c688e0794d450b815b28f58e1d83.jar
E:\android\CFPEvents\Gradleprojectcfp-android-user\app\build\intermediates\pre-dexed\debug\internal_impl-20.0.0-70abc57678073852a9e6f7ebae30976bb22ec41d.jar
E:\android\CFPEvents\Gradleprojectcfp-android-user\app\build\intermediates\pre-dexed\debug\universal-image-loader-1.9.1-b9c11698ebf40b256b359f271d0bd7e3629612d8.jar
E:\android\CFPEvents\Gradleprojectcfp-android-user\app\build\intermediates\pre-dexed\debug\xstream-1.4.7-816d435be49dd5bc1f491c17effc3dddbc49ba4a.jar
E:\android\CFPEvents\Gradleprojectcfp-android-user\app\build\intermediates\pre-dexed\debug\libGoogleAnalyticsServices-e2a7597e511aa28da2b973eefa67e920097e0deb.jar
E:\android\CFPEvents\Gradleprojectcfp-android-user\app\build\intermediates\pre-dexed\debug\google-play-services-ee4019f3cee39571bf6dc0f712c4b22b32b6cae3.jar
E:\android\CFPEvents\Gradleprojectcfp-android-user\app\build\intermediates\pre-dexed\debug\android-support-v4-7ec2c6eefdabe7608a38cfb42d3fa0ec0fa556d2.jar
E:\android\CFPEvents\Gradleprojectcfp-android-user\app\build\intermediates\pre-dexed\debug\classes-99d7a950ad16ef4b71207dd3f54ad9df9c933c00.jar
E:\android\CFPEvents\Gradleprojectcfp-android-user\app\build\intermediates\pre-dexed\debug\classes-6090079305bc6decaac8787edd923af44cc8510d.jar
build.gradle文件:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile files('libs/libGoogleAnalyticsServices.jar')
compile files('libs/universal-image-loader-1.9.1.jar')
compile files('libs/xstream-1.4.7.jar')
compile files('libs/android-support-v4.jar')
compile files('libs/google-play-services.jar')
compile 'com.google.android.gms:play-services:6.1.71'
}
在Android清单文件中添加了Googleplayserices
机器人:的minSdkVersion = “14” 机器人:targetSDKversion = “19”
请帮帮我
答案 0 :(得分:2)
如果您的项目中有多个相同库的实例作为依赖项,则会出现此问题。特定于您的是Google Play服务
删除
compile files('libs/google-play-services.jar')
并从libs目录中删除jar,因为你通过在依赖关系中写第一行来将lib目录中的所有jar包含到你的依赖项中。 完成所有项目与gradle同步后。