Android Studio: Error Code 1: Gradle: Execution failed for task ':app:processDebugResources'

孤街浪徒 提交于 2019-11-30 11:32:05

I had the same problem while using a third party library.

To solve it, I moved my ic_launcher.png files from drawable folder to mipmap folder. And problem solved.

  • In case you administrate your own aar files:

You have to ensure that your gradle and buildToolsVersion are identically in your project and the used aars.

  • In case you use external libs where you can't control the gradle/build version:

Contact the author or check the sources by your own. Some libraries have unused launcher icons which will cause this conflict. Removing this icons will solve your problem. Identically named sources (e.g menu.xml) could also cause this issue in rare cases. An easy workaround would be to rename your ressource.

Simply Rename the Image (Rightclick on the Image, Select Refactor and select Rename). It will solve the issue as the Issue has arise as one of the library/Module is also using the image with the same name.

Adding aaptOptions.cruncherEnabled = false in app.gradle solved mine

In case any one else has this problem and none of the mentioned answers solved your issue you can add this line to your AndroidManifest.xml file in the application tag:

tools:replace="android:icon

You also need the tool namespace in you manifest tag

xmlns:tools="http://schemas.android.com/tools"

So it would look like this:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      package="com.example.sqlite" >`

   <application
        android:allowBackup="true"
        android:label="@string/app_name"
        android:theme="@style/AppTheme"
        tools:replace="android:icon"
        android:icon="@mipmap/ic_launcher"
        android:name="com.orm.SugarApp">

I have the com.github.satyan:sugar:1.3 dependency as well, I believe that library is importing another icon in its own manifest, thus causing the conflict.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!