MuntashirAkon/AppManager · error · IllegalArgumentException
Namespaces are not supported
Error message
Namespaces are not supported
What it means
BinaryXmlSerializer does not support XML namespaces: illegalNamespace() throws IllegalArgumentException whenever a non-null namespace is supplied to startTag, endTag, attribute, attributeInterned, attributeBytesHex, or attributeBytesBase64.
Solutions
- Pass null as the namespace argument to all serializer calls.
- Encode the namespace into the tag/attribute name (e.g. "ns:name") if namespacing semantics are needed.
- Switch to a namespaces-capable serializer (Xml.newSerializer with FEATURE_PROCESS_NAMESPACES) if namespaces are required.
- Refactor the document schema to avoid namespaces entirely.
Example fix
// before
serializer.startTag("http://schemas.android.com/apk/res/android", "manifest");
// after
serializer.startTag(null, "manifest"); Defensive patterns
Strategy: validation
Validate before calling
if (namespace != null) {
throw new IllegalStateException("BinaryXmlSerializer does not support namespaces; pass null");
} Try / catch
try {
serializer.startTag(ns, name);
} catch (IllegalArgumentException e) {
serializer.startTag(null, name); // retry namespace-free
} Prevention
- Always pass null as the namespace to every BinaryXmlSerializer call.
- Wrap the serializer behind your own facade that drops namespaces.
- If namespaces are required, use Xml.newSerializer with namespace processing instead.
- Encode namespace semantics into element/attribute names if needed.
When it happens
Trigger: Calling serializer.startTag("http://example.com/ns", "tag"), serializer.attribute(ns, name, value), or any of the attribute* variants with a non-null namespace string.
Common situations: Porting code from XmlSerializer/Xml.newSerializer which accepts namespaces, or generating documents that originally used namespaced elements — Android's binary XML format intentionally drops namespace support.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
AI-assisted analysis of MuntashirAkon/AppManager@0152f468fc (2026-09-12).
Data as JSON: /api/errors/ab11d67ea192a79f.
Report an issue: GitHub.
Appendix: source
Thrown at libcore/compat/src/main/java/io/github/muntashirakon/compat/xml/BinaryXmlSerializer.java:383
public Object getProperty(String name) {
// Properties are not supported
throw new UnsupportedOperationException();
}
@Override
public void setPrefix(String prefix, String namespace) {
// Prefixes are not supported
throw new UnsupportedOperationException();
}
@Override
public String getPrefix(String namespace, boolean generatePrefix) {
// Prefixes are not supported
throw new UnsupportedOperationException();
}
private static IllegalArgumentException illegalNamespace() {
throw new IllegalArgumentException("Namespaces are not supported");
}
}View on GitHub (pinned to 0152f468fc)