Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio - mergeDebugResources exception

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.


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


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


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.


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


This would also happen if there is/are any additional folder/files in resource folder which are not supported by Android.