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

前端 未结 5 2035
醉话见心
醉话见心 2021-01-01 21:08

I want to compile a project, I got Error:Gradle: Execution failed for task \':app:processDebugResources\'.

here is the exception:

相关标签:
5条回答
  • 2021-01-01 21:42
    • 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.

    0 讨论(0)
  • 2021-01-01 21:51

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

    0 讨论(0)
  • 2021-01-01 21:52

    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.

    0 讨论(0)
  • 2021-01-01 21:59

    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.

    enter image description here

    0 讨论(0)
  • 2021-01-01 22:02

    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.

    0 讨论(0)
提交回复
热议问题