Tencent/matrix · error · AndrolibException
Could not decode XML,<var7.getMessage()>
Error message
Could not decode XML,<var7.getMessage()>
What it means
XmlPullResourceRefDecoder.decode() parses Android binary/resource XML with an XmlPullParser; on XmlPullParserException it wraps the failure in AndrolibException("Could not decode XML,..."). Called from decodeResResource, decodeResValues and decodeResourcesRef when decoding the compiled resource XML inside the APK.
Solutions
- Inspect var7.getMessage() in the AndrolibException cause for the parse position and token type.
- Analyze an APK built without resource obfuscation, or supply the matching resguard mapping so names decode correctly.
- Verify the extracted XML files are complete (re-unzip to a clean directory) and match the target SDK's binary XML format.
Example fix
// before
// analyzing an AndResGuard-processed APK with default decoder config
// after
config.setResMappingFilePath("build/resguard/resguard-mapping.txt"); // enable proper decoding Defensive patterns
Strategy: try-catch
Validate before calling
// ensure the APK entry to decode exists and is non-empty
ZipEntry entry = zipFile.getEntry("AndroidManifest.xml");
if (entry == null || entry.getSize() == 0) {
throw new IllegalStateException("Required XML entry missing or empty");
} Try / catch
try {
decoder.decode(inputStream);
} catch (AndrolibException e) {
if (e.getMessage().startsWith("Could not decode XML")) {
logger.error("Binary XML decode failed (possibly obfuscated resources): " + e.getMessage(), e.getCause());
} else throw e;
} Prevention
- Don't feed non-binary (plain-text) XML streams into the decoder.
- Provide the matching resguard/AndResGuard mapping for obfuscated APKs.
- Re-extract to a clean directory to rule out truncated XML entries.
When it happens
Trigger: Feeding a malformed, non-binary, or truncated XML stream (e.g. plain-text XML where compiled binary XML is expected, or AAPT2-obfuscated resources) into decode via UnzipTask's resource analysis.
Common situations: Analyzing APKs built with resource obfuscation/packers (e.g. AndResGuard variants) that alter binary XML structure; truncated extraction due to disk issues; hand-modified resource files.
Related errors
- Parse xml error,<e.getMessage()>
- ---jobConfig can not be null!
- ---params can not be null!
- ---APK-UNZIP-PATH can not be null!
- ---APK-UNZIP-PATH ' ' is not exist!
AI-assisted analysis of Tencent/matrix@3b8293bd65 (2026-09-08).
Data as JSON: /api/errors/6a5849b03fb02b1e.
Report an issue: GitHub.
Appendix: source
Thrown at matrix/matrix-android/matrix-apk-canary/src/main/java/com/tencent/matrix/apk/model/task/util/XmlPullResourceRefDecoder.java:69
mParser.setInput(inputStream, null);
int token = mParser.next();
while (token != XmlPullParser.END_DOCUMENT) {
switch (token) {
case XmlPullParser.START_TAG:
handleElement();
break;
case XmlPullParser.TEXT:
handleContent();
break;
default:
break;
}
token = mParser.next();
}
// Log.i(TAG, "find resource references: %s", resourceRefSet);
inputStream.close();
} catch (XmlPullParserException var7) {
throw new AndrolibException("Could not decode XML," + var7.getMessage(), var7);
} catch (IOException e) {
throw new AndrolibException("Parse xml error," + e.getMessage(), e);
}
}
private void handleElement() {
String tagName = mParser.getName();
int pointIndex = tagName.lastIndexOf('.');
if (pointIndex >= 0) {
tagName = tagName.substring(pointIndex + 1);
}
if (!Util.isNullOrNil(tagName)) {
for (int i = 0; i < mParser.getAttributeCount(); i++) {
String value = mParser.getAttributeValue(i);
//Log.d(TAG, "attribute %s, %s", name, value);
if (!Util.isNullOrNil(value)) {
if (value.startsWith("@")) {
int index = value.indexOf('/');View on GitHub (pinned to 3b8293bd65)