Android 已定义资源条目ic_启动器

Android 已定义资源条目ic_启动器,android,android-gradle-plugin,Android,Android Gradle Plugin,我想在我的android studio项目中使用这个库 https://github.com/daimajia/AndroidImageSlider 当我把它放在我的gradle文件中时,它会显示这些错误 Information:Gradle tasks [:app:generateDebugSources] Information:res\drawable-mdpi-v4\ic_launcher.png:0: error: Resource entry ic_launcher is alre

我想在我的android studio项目中使用这个库

https://github.com/daimajia/AndroidImageSlider
当我把它放在我的gradle文件中时,它会显示这些错误

Information:Gradle tasks [:app:generateDebugSources]
Information:res\drawable-mdpi-v4\ic_launcher.png:0: error: Resource entry ic_launcher is already defined.
Information:res\drawable-mdpi\ic_launcher.png:0: Originally defined here.
Information:res\drawable-xhdpi-v4\ic_launcher.png:0: error: Resource entry ic_launcher is already defined.
Information:res\drawable-xhdpi\ic_launcher.png:0: Originally defined here.
Information:res\drawable-xxhdpi-v4\ic_launcher.png:0: error: Resource entry ic_launcher is already defined.
Information:res\drawable-xxhdpi\ic_launcher.png:0: Originally defined here.
Information:1 error
Information:0 warnings
Information:See complete output in console
Error:Execution failed for task ':app:processDebugResources'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
    C:\Users\Razi\AppData\Local\Android\android-studio\sdk\build-tools\19.1.0\aapt.exe package -f --no-crunch -I C:\Users\Razi\AppData\Local\Android\android-studio\sdk\platforms\android-19\android.jar -M C:\Users\Razi\AndroidStudioProjects\AllahNames\app\build\manifests\debug\AndroidManifest.xml -S C:\Users\Razi\AndroidStudioProjects\AllahNames\app\build\res\all\debug -A C:\Users\Razi\AndroidStudioProjects\AllahNames\app\build\assets\debug -m -J C:\Users\Razi\AndroidStudioProjects\AllahNames\app\build\source\r\debug -F C:\Users\Razi\AndroidStudioProjects\AllahNames\app\build\libs\app-debug.ap_ --debug-mode --custom-package com.ua.allahnames.app --output-text-symbols C:\Users\Razi\AndroidStudioProjects\AllahNames\app\build\symbols\debug
Error Code:
    1
Output:
    res\drawable-mdpi-v4\ic_launcher.png:0: error: Resource entry ic_launcher is already defined.
    res\drawable-mdpi\ic_launcher.png:0: Originally defined here.
    res\drawable-xhdpi-v4\ic_launcher.png:0: error: Resource entry ic_launcher is already defined.
    res\drawable-xhdpi\ic_launcher.png:0: Originally defined here.
    res\drawable-xxhdpi-v4\ic_launcher.png:0: error: Resource entry ic_launcher is already defined.
    res\drawable-xxhdpi\ic_launcher.png:0: Originally defined here.
ic_启动器已定义! 可能是什么错误? 我曾尝试将构建工具更改为19.1.0,但我不认为这是一个问题

这是我的build.gradle代码

dependencies {
    compile 'com.android.support:appcompat-v7:+'
    compile 'com.daimajia.slider:library:1.0.1@aar'
    compile fileTree(dir: 'libs', include: ['*.jar'])
}
我是这本书的作者。我很抱歉给你添了麻烦

有一个解决方案,您可以尝试一下:

重命名
ic_启动器
(在您的项目中
res/drawable hdpi
res/drawable mdpi
res/drawable xhdpi
res/drawable xxhdpi


当有两个文件同名时,就会出现此问题。

您应该清理并重新构建项目。为此,您需要使Android Studio失效,然后重新启动

检查下图


也许文件被emulator锁定了,重新启动emulator&IDE。

呃,你不需要从下载整个项目树,包括它的资源文件吗?我没有下载它,我已经在build.gradle中放了一行代码。请看上面更新的问题。你所做的就是在构建脚本中包含相关的JAR。资源文件呢?这就是为什么你会出错。您需要将项目下载到某个地方,然后将整个项目包含到您的项目中。如果没有资源文件,Gradle会抱怨的。好的,你能告诉我怎么做吗。。。下载文件夹有一个演示和库文件夹我应该包括这两个或图书馆只。。。如果你用代码示例来回答这个问题,我将不胜感激。从你的帖子中,我看不出你在使用什么样的IDE。但对于Eclipse,我会执行文件->导入->Android->将现有的Android代码导入工作区->然后,当出现提示时,浏览到AndroidImageSlider的目录并选择它。我不熟悉Android Studio(AS),所以,如果您使用它,您可能需要为AS搜索类似的答案。对不起,我发布了一个新版本解决了这个问题。我发布来修复这个问题。是的,我在同一天通过重命名ic_启动器文件修复了它,但我想知道我将如何放置我自己的ic_启动器,但谢谢,现在我可以用这个修复来完成它。。。谢谢你的回复@WasifKhalil如果您再次遇到类似的情况,您可以在各自的文件夹中重命名ic_launcher.png文件,然后将引用的图像从ic_launcher更改为清单中的新名称。不过,我相信作者很快就会对这个库进行修复。