Tencent/matrix · error · TaskExecuteException

TaskExecuteException wrapping e.getMessage()

Error message

TaskExecuteException wrapping e.getMessage()

What it means

ManifestAnalyzeTask.call() wraps any Exception raised while parsing AndroidManifest.xml (via the axml parsing library and Res StreamReader) into TaskExecuteException with e.getMessage(). Typical wrapped causes are malformed/undecodable binary XML, missing resources.arsc, or stream parsing errors.

Solutions

  1. Inspect the cause chain to find the real parsing error (corrupt XML, missing arsc, IO).
  2. Re-unzip a freshly built/intact APK and retry the analysis.
  3. If the APK uses resource obfuscation, analyze the original un-obfuscated build or a matrix-compatible tool version.
  4. Update Matrix to the latest version for newer AAPT2/binary-XML format support.

Example fix

// before
// analyzing an obfuscated APK: resources.arsc names stripped, parse fails
// after
// run the checker on the un-obfuscated APK build output
ApkChecker.run(configWithUnzippedPath(originalApkBuildDir));
Defensive patterns

Strategy: try-catch

Validate before calling

File manifest = new File(config.getUnzipPath(), "AndroidManifest.xml");
File arsc = new File(config.getUnzipPath(), "resources.arsc");
if (!manifest.exists() || !arsc.exists()) {
    throw new IllegalStateException("manifest/resources.arsc must exist and be intact for parsing");
}

Try / catch

try {
    taskResult = manifestAnalyzeTask.call();
} catch (TaskExecuteException e) {
    log.severe("manifest parse failed: " + e.getMessage() + " cause=" + e.getCause());
    // re-unzip intact APK or upgrade Matrix parser, then retry
}

Prevention

When it happens

Trigger: call() fails when the manifest XML is corrupt or in unexpected format, resources.arsc is missing/mismatched, or an IOException occurs while streaming the manifest.

Common situations: Analyzing an APK processed by aggressive resource obfuscation; manifest from a newer AAPT2 format the parser can't handle; truncated download/copy of the APK before unzipping.

Understand the failure class

Background: JSON parse error: "Unexpected token" / "not valid JSON" / "failed to parse" — what JSON parsers are really complaining about — this error's family across 45 libraries.

Related errors


AI-assisted analysis of Tencent/matrix@3b8293bd65 (2026-09-08). Data as JSON: /api/errors/8e307b1581042a24. Report an issue: GitHub.

Appendix: source

Thrown at matrix/matrix-android/matrix-apk-canary/src/main/java/com/tencent/matrix/apk/model/task/ManifestAnalyzeTask.java:91

            ManifestParser manifestParser = null;
            if (!FileUtil.isLegalFile(arscFile)) {
                manifestParser = new ManifestParser(inputFile);
            } else {
                manifestParser = new ManifestParser(inputFile, arscFile);
            }
            TaskResult taskResult = TaskResultFactory.factory(getType(), TASK_RESULT_TYPE_JSON, config);
            if (taskResult == null) {
                return null;
            }
            long startTime = System.currentTimeMillis();
            JsonObject jsonObject = manifestParser.parse();
            Log.d(TAG, jsonObject.toString());
            ((TaskJsonResult) taskResult).add("manifest", jsonObject);
            taskResult.setStartTime(startTime);
            taskResult.setEndTime(System.currentTimeMillis());
            return taskResult;
        } catch (Exception e) {
            throw new TaskExecuteException(e.getMessage(), e);
        }
    }
}

View on GitHub (pinned to 3b8293bd65)