java 资源条目已定义
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/27320120/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Resource entry is already defined
提问by user2212773
I'm trying to add a splash.png image but when I compile it says this:
我正在尝试添加一个 splash.png 图像,但是当我编译它时,它说:
Error:error: Resource entry splash is already defined.
res\drawable-hdpi-v4\splash.jpg:0: Originally defined here.
Error:error: Resource entry splash is already defined.
res\drawable-xhdpi-v4\splash.jpg:0: Originally defined here.
Error:error: Resource entry splash is already defined.
res\drawable-xxhdpi-v4\splash.jpg:0: Originally defined here.
Error:Execution failed for task ':app:processDebugResources'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
C:\Users\German\AppData\Local\Android\android-sdk\build-tools.1.0\aapt.exe package -f --no- crunch -I C:\Users\German\AppData\Local\Android\android-sdk\platforms\android-12\android.jar -M C:\Users\German\AndroidStudioProjects\BASEUNODISCO\app\build\intermediates\manifests\full\debug\AndroidManifest.xml -S C:\Users\German\AndroidStudioProjects\BASEUNODISCO\app\build\intermediates\res\debug -A C:\Users\German\AndroidStudioProjects\BASEUNODISCO\app\build\intermediates\assets\debug -m -J C:\Users\German\AndroidStudioProjects\BASEUNODISCO\app\build\generated\source\r\debug -F C:\Users\German\AndroidStudioProjects\BASEUNODISCO\app\build\intermediates\res\resources-debug.ap_ --debug-mode --custom-package disepro.baseunodisco -0 apk --output-text-symbols C:\Users\German\AndroidStudioProjects\BASEUNODISCO\app\build\intermediates\symbols\debug
Error Code:
1
Output:
res\drawable-hdpi-v4\splash.png:0: error: Resource entry splash is already defined.
res\drawable-hdpi-v4\splash.jpg:0: Originally defined here.
res\drawable-xhdpi-v4\splash.png:0: error: Resource entry splash is already defined.
res\drawable-xhdpi-v4\splash.jpg:0: Originally defined here.
res\drawable-xxhdpi-v4\splash.png:0: error: Resource entry splash is already defined.
res\drawable-xxhdpi-v4\splash.jpg:0: Originally defined here.
The thing is that I don't have any splash.jpg in my files!! I once put one splash.jpg but I 've already delete it
问题是我的文件中没有任何 splash.jpg !!我曾经放了一张 splash.jpg 但我已经删除了
Please help! It's getting me nervous
请帮忙!这让我很紧张
回答by Kuba ?apuszyński
Did you tried to clean your project?
您是否尝试清理您的项目?
menu -> project -> clean
菜单 -> 项目 -> 清理
回答by Jorgesys
The problem is that you can′t have the same file name inside your drawable
folder:
问题是你的文件drawable
夹中不能有相同的文件名:
res\drawable-hdpi-v4\splash.png:0: error: Resource entry splash is already defined.
res\drawable-hdpi-v4\splash.jpg:0: Originally defined here.
must have only a .png
or .jpg
file
必须只有一个.png
或.jpg
文件
delete repeated files and clean your project: Project
-> Clean
删除重复的文件并清理您的项目:Project
->Clean
回答by SithuSena
In Android Studioyou can get rid of this error message by doing,
在Android Studio 中,您可以通过执行以下操作来消除此错误消息,
Build->Clean Project
构建->清理项目
回答by Zeeshan Ghazanfar
I was also having that issue. But with me, deleting bin folder and then clean and build project solved the issue. Actually duplicates files were in bin/res folder.
我也遇到了这个问题。但是对我来说,删除 bin 文件夹然后清理并构建项目解决了这个问题。实际上重复的文件在 bin/res 文件夹中。