Tencent/matrix · error · TaskInitException

---APK-UNZIP-PATH can not be null!

Error message

---APK-UNZIP-PATH can not be null!

What it means

ManifestAnalyzeTask throws TaskInitException during init() when config.getUnzipPath() is null or empty. This task parses AndroidManifest.xml from the unzipped APK to extract package name, versions, components, and permissions.

Solutions

  1. Add '--unzip <dir>' to the ApkChecker command or call config.setUnzipPath(path).
  2. Ensure the unzip step runs and populates the config before ManifestAnalyzeTask init.
  3. Log config.getUnzipPath() before task execution to catch nulls early.

Example fix

// before
JobConfig config = new JobConfig();
config.addTask(TaskFactory.TASK_TYPE_MANIFEST_ANALYZE); // no unzip path
// after
config.setUnzipPath("/build/unzipped-apk/");
config.addTask(TaskFactory.TASK_TYPE_MANIFEST_ANALYZE);
Defensive patterns

Strategy: validation

Validate before calling

String unzipPath = config.getUnzipPath();
if (unzipPath == null || unzipPath.trim().isEmpty()) {
    throw new IllegalStateException("unzip path must be set before running ManifestAnalyzeTask");
}

Try / catch

try {
    task.init();
} catch (TaskInitException e) {
    if (e.getMessage().contains("APK-UNZIP-PATH can not be null")) {
        config.setUnzipPath(extractedDir.getAbsolutePath());
    }
}

Prevention

When it happens

Trigger: Running ManifestAnalyzeTask with a JobConfig whose PARAM_UNZIP_PATH is null or empty (e.g. missing '--unzip' CLI option).

Common situations: Invoking ApkChecker with --task ManifestAnalyze but forgetting --unzip; programmatic config missing setUnzipPath; configuration overwritten by another task.

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


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

public class ManifestAnalyzeTask extends ApkTask {

    private static final String TAG = "Matrix.ManifestAnalyzeTask";

    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);

View on GitHub (pinned to 3b8293bd65)