Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

here is the exception:

Error:Gradle: Execution failed for task ':app:processDebugResources'. com.android.ide.common.internal.LoggedErrorException: Failed to run command:

D:\devtools\adt\sdk\build-tools\21.1.1\aapt.exe package -f --no-crunch -I D:\devtools\adt\sdk\platforms\android-21\android.jar -M E:\code\android\TVMediaPlayer\app\build\manifests\debug\AndroidManifest.xml -S E:\code\android\TVMediaPlayer\app\build\res\all\debug -A E:\code\android\TVMediaPlayer\app\build\assets\debug -m -J E:\code\android\TVMediaPlayer\app\build\source\r\debug -F E:\code\android\TVMediaPlayer\app\build\libs\app-debug.ap_ --debug-mode --custom-package com.skyworth.tvmediaplayer.app --output-text-symbols E:\code\android\TVMediaPlayer\app\build\symbols\debug

Error Code: 1

Output: E:\code\android\TVMediaPlayer\app\build\res\all\debug\drawable-hdpi-v4\ic_launcher.png: error: Duplicate file. E:\code\android\TVMediaPlayer\app\build\res\all\debug\drawable-hdpi\ic_launcher.png: Original is here. The version qualifier may be implied.

here is the gradle file:

    android {
        compileSdkVersion 21
        buildToolsVersion "21.0.2"

        defaultConfig {
            applicationId "com.jerrellmardis.amphitheatre"
            minSdkVersion 21
            targetSdkVersion 21
            versionCode 1
            versionName "1.0"
            renderscriptTargetApi 19

            buildConfigField "String", "TMDB_API_KEY", "\"${loadSecret("TMDB_API_KEY")}\""
        }
......
dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:recyclerview-v7:21.0.0'
    compile 'com.android.support:leanback-v17:21.0.0'
    compile 'com.android.support:appcompat-v7:21.0.0'
    compile 'com.android.support:palette-v7:21.0.0'
    compile 'com.squareup.picasso:picasso:2.3.4'
    compile 'com.squareup.retrofit:retrofit:1.7.1'
    compile 'com.google.code.gson:gson:2.3'
    compile 'org.apache.commons:commons-lang3:3.3.2'
    compile 'org.apache.commons:commons-collections4:4.0'
    compile 'com.jakewharton:butterknife:6.0.0'
    compile 'com.github.satyan:sugar:1.3'
}

I am puzzled about the error message, am I put the wrong png file or my gradle config file is wrong?

like image 459
roger Avatar asked Dec 10 '14 13:12

roger


People also ask

How do I fix Processdebugresources app?

The only way to solve some errors is to clean out the cached data which can be done by Navigating to File > Invalidate Caches/Restart > Invalidate Cache and Restart.

What is Android resource linking failed?

The following error typically occurs in Unity 2019 and indicates that your Gradle version does not support AndroidX: /Temp/gradleOut/launcher/build/intermediates/merged_manifests/release/AndroidManifest.


2 Answers

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

like image 142
Hoshouns Avatar answered Sep 28 '22 08:09

Hoshouns


  • 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.

like image 31
0xPixelfrost Avatar answered Sep 28 '22 08:09

0xPixelfrost