资源条目已经定义

时间:2014-12-05 16:11:47

标签: java android android-resources android-drawable

我试图添加一个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\19.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.

事情是,我的文件中没有任何splash.jpg !! 我曾经把一个splash.jpg但我已经删除它了

请帮忙!这让我很紧张

4 个答案:

答案 0 :(得分:9)

您是否尝试过清理项目?

菜单 - >项目 - >清洁

答案 1 :(得分:6)

问题是您的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.

必须只有.png.jpg个文件

删除重复的文件并清理项目:Project - > Clean

答案 2 :(得分:1)

Android Studio 中,您可以通过执行

来消除此错误消息

构建 - >清理项目

答案 3 :(得分:0)

我也遇到了这个问题。但对我来说,删除bin文件夹然后清理和构建项目解决了这个问题。 实际上重复文件位于bin / res文件夹中。