android - Android Studio:代码有重复资源错误,我该如何解决?
问题描述
我刚开始学习 Android Studio。我正在开发一个生日贺卡应用程序。这是我的代码:
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<TextView
android:text="Happy Birthday,Seetha Hari!"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"/>
<TextView
android:text="From, Srinitya Suripeddi"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true" />
<ImageView
android:id="@+id/birthday"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src ="@drawable/birthday" />
</RelativeLayout>
我得到了:
AGPBI: {"kind":"error","text":"Duplicate resources","sources":[{"file":{"description":"drawable/birthday","path":"/home/hse/AndroidStudioProjects/HappieBirthday/app/src/main/res/drawable/birthday.jpg"}},{"file":{"description":"drawable/birthday","path":"/home/hse/AndroidStudioProjects/HappieBirthday/app/src/main/res/drawable/birthday.xml"}}],"tool":"Resource and asset merger"}
Execution failed for task ':app:mergeDebugResources'.
> [drawable/birthday] /home/hse/AndroidStudioProjects/HappieBirthday/app/src/main/res/drawable/birthday.jpg [drawable/birthday] /home/hse/AndroidStudioProjects/HappieBirthday/app/src/main/res/drawable/birthday.xml: Error: Duplicate resources
运行应用程序时出现重复资源错误。
请帮忙。PS:我的操作系统是 Ubuntu。我不知道这是否有什么不同
解决方案
看看 -> 你的可绘制文件夹名称中有一个同名的文件生日.jpg
请删除 1 并重试完整路径为 -> res/drawable/birthday.jpg
推荐阅读
- php - PHP - WordPress 所需的 MySQL 扩展
- c - 线程在 pthread_create 之后立即执行?
- javascript - 如何在选择框中显示类别以更新记录?
- python-2.7 - 在python中模拟请求库的单元测试抛出没有名为mock的模块
- nuget - 带有命令==自定义选项的 VSO/Azure 开发操作中的 Nuget 2.* 任务
- c++ - 将多个嵌套的模板类传递给模板函数
- android - Intellij IDEA在使用flutter时不会从android studio中获取AVD
- python - Python 2.7 忽略 URLError:
- arrays - 如何创建一个包含所有工作表的数组
- ios - 如何将数据和 segue 传递给嵌入在 Swift 不同选项卡中的导航控制器中的视图控制器?