skylot/jadx · error · JadxRuntimeException

BinaryXMLParser init error

Error message

BinaryXMLParser init error

What it means

Thrown in the BinaryXMLParser constructor when rootNode.getConstValues() or constStorage.getResourcesNames() throws. The constructor initializes the resource-name map needed for binary XML (AndroidManifest.xml) parsing. A failure here indicates an internal jadx state problem — the RootNode was not fully initialized, or the ConstStorage encountered an error collecting constant values from the DEX files.

Source

Thrown at jadx-core/src/main/java/jadx/core/xmlgen/BinaryXMLParser.java:60

	private boolean firstElement;
	private ValuesParser valuesParser;
	private boolean isLastEnd = true;
	private boolean isOneLine = true;
	private int namespaceDepth = 0;
	private @Nullable int[] resourceIds;
	private String appPackageName;

	private Map<String, ClassNode> classNameCache;

	public BinaryXMLParser(RootNode rootNode) {
		this.rootNode = rootNode;
		this.manifestAttributes = rootNode.initManifestAttributes();
		this.attrNewLine = !rootNode.getArgs().isSkipXmlPrettyPrint();
		try {
			ConstStorage constStorage = rootNode.getConstValues();
			resNames = constStorage.getResourcesNames();
		} catch (Exception e) {
			throw new JadxRuntimeException("BinaryXMLParser init error", e);
		}
	}

	public synchronized ICodeInfo parse(InputStream inputStream) throws IOException {
		resourceIds = null;
		is = new ParserStream(inputStream);
		if (!isBinaryXml()) {
			return ResourcesLoader.loadToCodeWriter(is);
		}
		nsMapGenerated = new HashSet<>();
		nsMap = new HashMap<>();
		definedNamespaces = new HashSet<>();
		writer = rootNode.makeCodeWriter();
		writer.add("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
		firstElement = true;
		decode();
		nsMap = null;
		definedNamespaces = null;

View on GitHub (pinned to e738a26571)

Solutions

  1. Ensure the RootNode is fully initialized (all DEX files loaded, const values collected) before constructing BinaryXMLParser.
  2. Follow the standard jadx decompilation entry point rather than constructing BinaryXMLParser directly.
  3. Inspect the wrapped cause to identify whether the failure is in getConstValues() or getResourcesNames().
  4. If the input APK/DEX is corrupted, validate it with standard tools (apksigner, unzip) first.

Example fix

// before — constructing parser too early
BinaryXMLParser parser = new BinaryXMLParser(rootNode);

// after — ensure const values are populated first
rootNode.getConstValues(); // force initialization
BinaryXMLParser parser = new BinaryXMLParser(rootNode);
Defensive patterns

Strategy: validation

Validate before calling

public static boolean isRootNodeReady(RootNode rootNode) {
    try {
        rootNode.getConstValues().getResourcesNames();
        return true;
    } catch (Exception e) {
        return false;
    }
}

Try / catch

try {
    BinaryXMLParser parser = new BinaryXMLParser(rootNode);
} catch (JadxRuntimeException e) {
    LOG.error("BinaryXMLParser init failed: {}", e.getCause().getMessage());
    // skip XML parsing for this resource
}

Prevention

When it happens

Trigger: Constructing a BinaryXMLParser with a RootNode whose ConstStorage has not been populated or threw during population. Calling getConstValues() before decompilation/constant-collection has run. An internal NPE if rootNode fields are null due to partial initialization.

Common situations: Programmatic use of jadx APIs that constructs a BinaryXMLParser before the full decompilation pipeline has initialized the RootNode. A corrupted or obfuscated DEX input that causes ConstStorage to throw. Memory pressure causing incomplete initialization.

Related errors


AI-assisted analysis of skylot/jadx@e738a26571 (2026-08-14). Data as JSON: /api/errors/4328d06c8b94567f. Report an issue: GitHub.