I’m encountering an issue during my Android project build in Android Studio. The build fails with the following error:
org.w3c.dom.DOMException: INVALID_CHARACTER_ERR: An invalid or illegal XML character is specified.
at java.xml/com.sun.org.apache.xerces.internal.dom.CoreDocumentImpl.createAttribute(Unknown Source)
at com.android.ide.common.resources.NodeUtils.processSingleNodeNamespace(NodeUtils.java:206)
at ...
Here are the details of my environment:
Gradle Version: 8.7
JDK Version: JetBrains Runtime 17.0.11 - aarch64
Platform: macOS (M3 Pro)
I’ve already tried the following without success:
Clean project and rebuild
Invalidate cache and restart
Fresh install of Android Studio
Download and use local Gradle installation
Could anyone suggest a solution or help identify the root cause? It seems related to XML resources, but I couldn’t find any obvious illegal characters.
This has nothing to do with Gradle it seems, so is off-topic here.
The part of the stacktrace you showed suggests this is something within Android Studio.
If it is coming from an Gradle build, you should probably show a full --stacktrace or if possible even better a build --scan URL.
But even then it probably would more be an Android Gradle Plugin question, than a Gradle question, if at all.
But from the error message I’d also expect that this is a problem with some character in some attribute of some XML you have, like having a < literally in an attribute value or similar.
So this would still not be a Gradle question.
If the full stacktrace does not hint at what file is the problem, you might need to debug to find out which file it complains about and maybe open a feature request to whereever the error is coming from to include the problematic file name in the error message.