Android Studio - Mergedebugresources Exception

Android Studio - mergeDebugResources exception

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 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 ''

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

Build android error at stage app:mergeDebugResources, ParseError AttributeNSNotUnique

The answer to this question is that the error and the stacktrace are actually two different problems.

There was a problem with one of my xml layouts, yes, but the biggest issue was that the version of gradle 4.2.1 has obfuscated how to find the problem.

So if you want to actually know what is failing, downgrade your gradle to 4.1.3 and gradle will now tell you where your xml is wrong. I recommend this whatever error you have, be it a parse error, a resource error or a prolog error.

Now, for the actual exception, Android Studio does not detect when an attribute is duplicated between the <layout> tag and another different layout, like constraintLayout, frameLayout, etc... so if you are using databinding, check that any extra layouts you are using don't have the same attribute. In fact I just recommend moving any attributes to your second, implementation specific layout and leave the databinding tag alone.

Gradle throw app:mergedebugresources exception

Sorry to update my answer.
Found out actually is 9 patch image with error format, one 9 patch image didn't proper draw the black corner line in the most outer.
My careless mistake! Really using photoshop not proper to make 9 patch image!
Previous ant project didn't notice this issue.

Now with Gradle that give proper check and throws exception.
However, the log message really not helpful for debug!

Related Topics

Leave a reply