Tencent/matrix · error · TaskInitException

---Manifest file ' /AndroidManifest.xml' is not exist!

Error message

---Manifest file '<inputPath>/AndroidManifest.xml' is not exist!

What it means

ManifestAnalyzeTask.init() throws TaskInitException when <unzipPath>/AndroidManifest.xml does not exist. It locates ApkConstants.MANIFEST_FILE_NAME inside the configured unzip directory and fails if the file is missing, meaning the directory is not a valid unzipped APK root.

Solutions

  1. Unzip the full APK so AndroidManifest.xml is present at the directory root.
  2. Verify with `ls <unzipPath>/AndroidManifest.xml` and correct the path.
  3. Ensure the unzip step extracts all entries (not only res/), or decode the manifest with apktool if it is absent.

Example fix

// before
config.setUnzipPath("/build/classes-only/"); // no AndroidManifest.xml
// after
config.setUnzipPath("/build/unzipped-apk/"); // contains AndroidManifest.xml
Defensive patterns

Strategy: validation

Validate before calling

File manifest = new File(config.getUnzipPath(), "AndroidManifest.xml");
if (!manifest.exists()) {
    throw new IllegalStateException("AndroidManifest.xml missing in " + config.getUnzipPath());
}

Try / catch

try {
    task.init();
} catch (TaskInitException e) {
    if (e.getMessage().contains("is not exist")) {
        // re-unzip fully or decode manifest with apktool, then retry
        unzipApk(apkFile, new File(config.getUnzipPath()));
    }
}

Prevention

When it happens

Trigger: config.getUnzipPath() points to a directory that exists but contains no AndroidManifest.xml (wrong directory, not unzipped, or manifest extracted under a different name).

Common situations: Pointing --unzip at an unrelated directory; manifest missing because unzip skipped binary manifest; using an AAB-extracted layout without a decoded AndroidManifest.xml; resource obfuscation tools relocating the manifest.

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


AI-assisted analysis of Tencent/matrix@3b8293bd65 (2026-09-08). Data as JSON: /api/errors/5b1228789d2c01dd. 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:64

    private File inputFile;
    private File arscFile;

    public ManifestAnalyzeTask(JobConfig config, Map<String, String> params) {
        super(config, params);
        type = TASK_TYPE_MANIFEST;
    }

    @Override
    public void init() throws TaskInitException {
        super.init();
        String inputPath = config.getUnzipPath();
        if (Util.isNullOrNil(inputPath)) {
            throw new TaskInitException(TAG + "---APK-UNZIP-PATH can not be null!");
        }
        Log.i(TAG, "inputPath:%s", inputPath);
        inputFile = new File(inputPath, ApkConstants.MANIFEST_FILE_NAME);
        if (!inputFile.exists()) {
            throw new TaskInitException(TAG + "---Manifest file '" + inputPath + File.separator + ApkConstants.MANIFEST_FILE_NAME + "' is not exist!");
        }

        arscFile = new File(inputPath, ApkConstants.ARSC_FILE_NAME);
    }

    @Override
    public TaskResult call() throws TaskExecuteException {
        try {
            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;
            }

View on GitHub (pinned to 3b8293bd65)