CardView 和 recycleView 重复错误

CardView and recycleView duplicate error

您好,我正在尝试在我的 android 工作室项目中使用卡片视图和回收视图。当我将 cardview 放入我的依赖项时,它工作正常。但是,当我将回收视图添加到依赖项时,出现错误。 有人可以告诉我如何解决这个问题吗?

我的依赖项:

dependencies {
compile files('libs/Parse-1.5.1.jar')
compile files('libs/achartengine-1.1.0.jar')
compile files('libs/android-support-v13.jar')
compile files('libs/picasso-2.3.2.jar')
compile 'com.android.support:cardview-v7:21.0.+'
}

错误代码:

错误:任务“:app:dexDebug”执行失败。

com.android.ide.common.internal.LoggedErrorException: Failed to run command: /Applications/adt-bundle-mac-x86_64-20140702/sdk/build-tools/21.1.1/dx --dex --no-optimize --output /Users/jonathan34c/AndroidstudioProjects/Cue_business1/app/build/intermediates/dex/debug --input-list=/Users/jonathan34c/AndroidstudioProjects/Cue_business1/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: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)

删除您的构建文件夹,然后重建它。并在您的应用中添加依赖项 gradle as

dependencies {
   compile 'com.android.support:cardview-v7:21.0.+'
   compile 'com.android.support:recyclerview-v7:21.0.+'
}

试试这个可能对你有帮助。