Android Studio - mergeDebugResources exception

android studio gradle build running forever
execution failed for task ':app:mergedebugresources react-native
task :app:mergedebugresources failed
android resource compilation failed
execution failed for task ':app:mergedebugresources jenkins
org gradle api tasks taskexecutionexception execution failed for task ':app:mergedebugresources
execute taskaction gradle android studio
execution failed for task ':app:mergedebugassets

I recently updated the Android Studio to it's latest version, and now I am experiencing a headache with an exception in Gradle build.

Every time I run the project, two or three times before it succeed, I get the following error:

Gradle: Execution failed for task ': ProjectName:
mergeDebugResources'.
Java.lang.NullPointerException (no error message)

After trying again a couple times, the error does not happen again until the next run.

Does anybody have any idea of why this is happening? The project worked just fine 'til the update, never got any error before...

Thanks!


I found a solution to the problem.

There is an issue reported about gradle build problems, it is not the same, but the solution seems to solve the mergeResourceDebug issues too. (issue here https://code.google.com/p/android/issues/detail?id=56158). In the comments it is stated that the solution is solved in Gradle 0.4.3.

To use Gradle 0.4.3, the build.gradle file needs to be updated manually. (Updating Android Studio does not change the build file)

Here is what I changed In build.gradle:

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

Since changing this, I have not seen any more mergeDebugResource issues when running my project. Hope this helps!

Edit: to stay up to date with Gradle you can change the version number to 0.4.+

Execution failed for task :':app:mergeDebugResources'. Android , FAILURE: Build failed with an exception. What went wrong: Execution failed for task ':app:mergeDebugResources'. Could not resolve all files for  ajax android angular api button c++ class database date dynamic exception file function html http image input java javascript jquery json laravel list mysql object oop ph php phplaravel phpmysql phpphp post python sed select spring sql string text time url view windows wordpress xml


It happens to me only when modifying the XML files on the project. If you rebuild the entire project before running (Build > Rebuild Project) it doesn't show up anymore.

android studio keeps showing me an error "app , So I transfered my android studio projects over and downloaded :app:​mergeDebugResources FAILURE: Build failed with an exception. Execution failed for task :':app:mergeDebugResources'. Android Studio. I changed mine as below and it worked. Now you can see four new options added to the bottom of the list, and among those you will find your appropriate option. I changed the file build. This problem is generated because of problem with the 9 patch image.


inside your project directory, run:

./gradlew clean build

or from Android Studio select:

Build > Clean Project

Updated: As @VinceFior pointed out in a comment below

Execution failed for task: app.mergeDebugResources, Hello All, When I build my android project in Android Studio it works [21:45:35][​Gradle failure report] FAILURE: Build failed with an exception. Hello. Having been working on Mac for a long time, I now have to start using a windows 10 PC. So I transfered my android studio projects over and downloaded android studio 3 to my pc.


You may have a corrupted .9.png in your drawables directory

Gradle build for android failed with app:mergeDebugResources in , Mon application fonctionnait bien, puis j'ai ajouté VCS de Git et mis à jour mon studio Android à 2.2. Maintenant, je suis coincé sur cette erreur la semaine  When I upgraded to Android Studio 0.6.1, I encountered a build issue with asset files. I kept getting “Content is not allowed in prolog” during the mergeDebugResources task. Since I couldn’t find a suitable answer to this and have since found a solution, I’ve answered my own question to help other developers who face this issue.


This error could also happen if the generated build file path exceeds the windows max path length of 255 characters. Make sure your project path is not too long, use short names as well.

java - : app: mergeDebugResources FAILED Android, Android app gradle build error - Task :app:mergeDebugResources FAILED Following error is thrown while building android app using gradle in Android studio, it is difficult to get FAILURE: Build failed with an exception. FAILURE: Build failed with an exception. What went wrong: Execution failed for task ':app:mergeDebugResources'. Could not resolve all files for configuration ':app:_internal_aapt2_binary'.


Android app gradle build error - Task :app , 3 steps to resolve Failed to crunch file Android studio %28app mergeDebugResources%29 Duration: 5:02 Posted: Oct 5, 2017 In Android Studio 1.4 with buildToolsVersion '22.0.1' the approach of fvasquezc23 worked for me with a restart and cache invalidation.. So, after you change the location of your project folder – copy/paste the folder onto disk D: (or somewhere else with no big ‘folder in folder’ structure), just


Android studio Build error + Error:Execution failed for task ':app , Only inspect this link - Android Studio - mergeDebugResources exception and libpng error: Not a PNG file Error displaying In Android Studio. Android studio not rendering layout preview Tags ajax android angular api button c++ class database date dynamic exception file function html http image input java javascript jquery json laravel list mysql object oop ph php phplaravel phpmysql phpphp post python sed select spring sql string text time url view windows wordpress xml


3 steps to resolve Failed to crunch file Android studio %28app , Gradle build for android failed with app:mergeDebugResources in TeamCity Follow. When I build my android project in Android Studio it works fine.