MuntashirAkon/AppManager · error · java.lang.IllegalArgumentException

Namespaces are not supported

Error message

Namespaces are not supported

What it means

This IllegalArgumentException('Namespaces are not supported') is thrown by the private illegalNamespace() helper whenever a namespace-aware XmlPullParser API is invoked: require(feature, ...) with a namespace feature, and getAttributeIndex(namespace, name). Binary XML parsing in this library is namespace-free by design.

Source

Thrown at libcore/compat/src/main/java/io/github/muntashirakon/compat/xml/BinaryXmlPullParser.java:669

    public boolean getFeature(String name) {
        // Features are not supported
        throw new UnsupportedOperationException();
    }

    @Override
    public void setProperty(String name, Object value) throws XmlPullParserException {
        // Properties are not supported
        throw new UnsupportedOperationException();
    }

    @Override
    public Object getProperty(String name) {
        // Properties are not supported
        throw new UnsupportedOperationException();
    }

    private static IllegalArgumentException illegalNamespace() {
        throw new IllegalArgumentException("Namespaces are not supported");
    }

    /**
     * Holder representing a single attribute. This design enables object
     * recycling without resorting to autoboxing.
     * <p>
     * To support conversion between human-readable XML and binary XML, the
     * various accessor methods will transparently convert from/to
     * human-readable values when needed.
     */
    private static class Attribute {
        public String name;
        public int type;

        public String valueString;
        public byte[] valueBytes;
        public int valueInt;
        public long valueLong;

View on GitHub (pinned to 0152f468fc)

Solutions

  1. Pass null as the namespace argument to require() and use the String[]-based or non-namespace getAttributeIndex overload
  2. Match attributes by plain local name only
  3. Pre-strip namespace expectations: binary XML attribute names are stored unqualified

Example fix

// before
int i = parser.getAttributeIndex("http://schemas.android.com/apk/res/android", "name");
// after
int i = parser.getAttributeIndex(null, "name");
Defensive patterns

Strategy: type-guard

Validate before calling

if (namespace != null && parser instanceof BinaryXmlPullParser) throw new IllegalStateException("namespace args unsupported");

Type guard

boolean acceptsNamespaceArgs(XmlPullParser p) { return !(p instanceof BinaryXmlPullParser); }

Try / catch

try { parser.require(t, ns, name); } catch (IllegalArgumentException e) { parser.require(t, null, name); }

Prevention

When it happens

Trigger: Calling parser.require(type, namespace, name) with a non-null namespace, or parser.getAttributeIndex(namespace, name) to look up an attribute by namespace.

Common situations: Namespace-qualified matching code reused from text XML parsing; lookup of Android attributes like http://schemas.android.com/apk/res/android names on binary XML.

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/de1b5298ac14c8ba. Report an issue: GitHub.