CardView和recycleView重复错误

时间:2015-02-05 06:19:58

标签: android android-studio android-recyclerview android-cardview

嗨我想在我的android工作室项目中使用cardview和回收视图。当我将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:无法运行命令:       /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     错误代码:       2     输出:       意外的顶级例外情况:       com.android.dex.DexException:多个dex文件定义Landroid / support / annotation / AnimRes;           在com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)           在com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)           在com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)           在com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)           在com.android.dx.merge.DexMerger.merge(DexMerger.java:189)           在com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:454)           在com.android.dx.command.dexer.Main.runMonoDex(Main.java:302)           在com.android.dx.command.dexer.Main.run(Main.java:245)           在com.android.dx.command.dexer.Main.main(Main.java:214)           在com.android.dx.command.Main.main(Main.java:106)

1 个答案:

答案 0 :(得分:1)

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

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

尝试这可能会对您有所帮助。