Android重复资源错误 [英] Android duplicate resources error

查看:126
本文介绍了Android重复资源错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的项目编译良好,直到我导航到 New> Vector Asset 删除了一些png绘图并将其替换为Vector绘图.我现在遇到重复资源错误.

My project was compiling fine until I deleted some png drawables and replaced them with vector drawables by navigating to New > Vector Asset. I am now getting a duplicate resources error.

这是我的res文件夹:

Here is my res folder:

这是Gradle控制台中的错误消息:

Here is the error message in the Gradle console:

Execution failed for task ':app:mergeDebugResources'.
> [drawable/ic_menu_manage] /Users/tomfinet/AndroidStudioProjects/Birthpay/app/src/main/res/drawable/ic_menu_manage.xml [drawable/ic_menu_manage] /Users/tomfinet/AndroidStudioProjects/Birthpay/app/src/main/res/values/drawables.xml: Error: Duplicate resources
  [drawable/ic_menu_share] /Users/tomfinet/AndroidStudioProjects/Birthpay/app/src/main/res/drawable/ic_menu_share.xml   [drawable/ic_menu_share] /Users/tomfinet/AndroidStudioProjects/Birthpay/app/src/main/res/values/drawables.xml: Error: Duplicate resources
  [drawable/ic_menu_slideshow] /Users/tomfinet/AndroidStudioProjects/Birthpay/app/src/main/res/drawable/ic_menu_slideshow.xml   [drawable/ic_menu_slideshow] /Users/tomfinet/AndroidStudioProjects/Birthpay/app/src/main/res/values/drawables.xml: Error: Duplicate resources
  [drawable/ic_menu_send] /Users/tomfinet/AndroidStudioProjects/Birthpay/app/src/main/res/drawable/ic_menu_send.xml [drawable/ic_menu_send] /Users/tomfinet/AndroidStudioProjects/Birthpay/app/src/main/res/values/drawables.xml: Error: Duplicate resources
  [drawable/ic_menu_gallery] /Users/tomfinet/AndroidStudioProjects/Birthpay/app/src/main/res/drawable/ic_menu_gallery.xml   [drawable/ic_menu_gallery] /Users/tomfinet/AndroidStudioProjects/Birthpay/app/src/main/res/values/drawables.xml: Error: Duplicate resources
  [drawable/ic_menu_camera] /Users/tomfinet/AndroidStudioProjects/Birthpay/app/src/main/res/drawable/ic_menu_camera.xml [drawable/ic_menu_camera] /Users/tomfinet/AndroidStudioProjects/Birthpay/app/src/main/res/values/drawables.xml: Error: Duplicate resources

该如何解决?为什么会发生?

How do I fix this and why is it happening?

推荐答案

该错误表明 drawable.xml 文件是导致该错误的原因.因此,我将其打开并注释掉了xml代码,该应用程序运行良好.我不知道为什么要解决这个问题,但这解决了这个问题.

The error suggests that the drawable.xml file is responsible for the error. So I opened it and commented out the xml code and the app ran fine. I have no idea why this fixes it but this solved the problem.

这篇关于Android重复资源错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆