[android] Execution failed for task :':app:mergeDebugResources'. Android Studio

I've just installed android studio and there's an error I don't know how to fix

enter image description here

This question is related to android

The answer is


How to fix app:mergeDebugResources in Android Studio (Resource path could not resolved / R.id is not accessible)

  • Go to the project folder from file explorer.
  • Delete(before delete Backup all files) .idea folder
  • If there are any .gradle folder do the 2nd step to the .gradle folder too.
  • If the Exception is referring any 3rd party library/jar file delete that also(keep a backup to add later)
  • Open the project again from Android studio as "Open an existing android studio project"
  • On right side gradle tab click "Refresh all Gradle projects".This will create the gradel project dependancies
  • Now add again 3rd party libraries to the same previous folder structure

This should resolve your Gradle issue.. good luck.


In My case, I've written below code in build.gradle

android {
// ...
aaptOptions.cruncherEnabled = false
aaptOptions.useNewCruncher = false
// ...
}

It's work for me!...


Okay here is a simple fix.

This error popped in front of me when I tried to manually change .jpg file to .png and then was copying & pasting it in my 'drawable' folder.

I rebuild and cleaned Project many times but nothing happened, then I removed that .png image and replaced that file with a different pre-existing .png image (or you can change it by help of paint and then paste it in drawable folder)

Now rebuild and clean the project . It works.

Hope it helps..!


I had that problem, but it was because my images changed them manually from .JPG to .PNG, so I just changed them with PNG paint and solved the problem


For me. I changed the color of .xml image (vector image) like this.

ic_action_add.xml

  <vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="24dp"
    android:height="24dp"
    android:viewportWidth="24"
    android:viewportHeight="24"
    android:tint="#FFFFFF"
    android:alpha="0.8">
  <path
      android:fillColor="@android:color/white"
      android:pathData="M19,13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/>
</vector>

to:

<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="24dp"
    android:height="24dp"
    android:viewportWidth="24"
    android:viewportHeight="24"
    android:tint="#FFFFFF"
    android:alpha="0.8">
  <path
      android:fillColor="#FF000000"
      android:pathData="M19,13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/>
</vector>

i just changed android:fillColor="@android:color/white" to android:fillColor="#FF000000"

and it's worked for me :)


By default, Android Studio has a maximum heap size of 1280MB. If you are working on a large project, or your system has a lot of RAM, you can improve performance by increasing the maximum heap size for Android Studio processes, such as the core IDE, Gradle daemon, and Kotlin daemon.

If you use a 64-bit system that has at least 5 GB of RAM, you can also adjust the heap sizes for your project manually. To do so, follow these steps:

Click File > Settings from the menu bar (or Android Studio > Preferences on macOS). Click Appearance & Behavior > System Settings > Memory Settings.

For more Info click

https://developer.android.com/studio/intro/studio-config

enter image description here


If you have recently used ionic cordova resources or ionic resources command please check the files generated in folders of platform/build/res there might be some files corrupted , so just delete those files and build the apk.. hope it helps someone worked for me


Try clean project...

If it doesn't work... Then... Goto build.gradle in project section

Try downgrading the gradle version

From...

dependencies {
    classpath 'com.android.tools.build:gradle:1.5.0'
}

To...

dependencies {
    classpath 'com.android.tools.build:gradle:1.2.0'
}

Then gradle.properties, add this

 org.gradle.jvmargs=-XX\:MaxHeapSize\=256m -Xmx256m

Sync it... Clean/Rebuild... It worked for me... So, I am sharing...


For me upgrading gradle version and plugin to the latest version did the trick.


I can see libc error in the log.

install these packages in your system

sudo apt-get install lib32stdc++6 lib32z1 lib32z1-dev

Restart android studio after installation


This issue can be resolved by trying multiple solutions like:

  1. Clean the project OR delete build folder and rebuild.
  2. Downgrading gradle version
  3. Check for the generated build file path, as it may be exceeding the windows max path length of 255 characters. Try using short names to make sure your project path is not too long.
  4. You may have a corrupted .9.png in your drawables directory

click here for the image

  1. Click Gradle in the right side tab

  2. Click the toggle offline icon (enable the Gradle online)

  3. Now try building the project

    And that's it!