Tencent/matrix · error · TaskInitException

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

Error message

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

What it means

FindNonAlphaPngTask throws TaskInitException during init() when config.getUnzipPath() is null or empty. This task scans PNG resources in the unzipped APK for non-alpha-channel images, and cannot run without the unzip location.

Solutions

  1. Set the unzip path: '--unzip <dir>' on the CLI or config.setUnzipPath(path) before running.
  2. Ensure UnzipTask executes before FindNonAlphaPngTask so the path is populated.
  3. Assert config.getUnzipPath() != null in your build script before invoking ApkChecker.

Example fix

// before
java -jar ApkChecker.jar --task FindNonAlphaPng   # missing --unzip
// after
java -jar ApkChecker.jar --task FindNonAlphaPng --unzip /build/unzipped-apk
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 FindNonAlphaPngTask");
}

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 FindNonAlphaPngTask (via ApkChecker task list) with JobConfig where PARAM_UNZIP_PATH is null or empty string.

Common situations: Omitting '--unzip <path>' from the ApkChecker command line; constructing config programmatically without setUnzipPath; config object reused/reset between tasks.

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/e73c0f277b480440. Report an issue: GitHub.

Appendix: source

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

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

    private File inputFile;
    private List<Pair<String, Long>> nonAlphaPngList;
    private long downLimitSize;
    private Map<String, Pair<Long, Long>> entrySizeMap;
    private Map<String, String> entryNameMap;

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

    @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!");
        }
        inputFile = new File(inputPath);
        if (!inputFile.exists()) {
            throw new TaskInitException(TAG + "---APK-UNZIP-PATH '" + inputPath + "'is not exists!");
        } else if (!inputFile.isDirectory()) {
            throw new TaskInitException(TAG + "---APK-UNZIP-PATH '" + inputPath + "' is not directory!");
        }
        if (params.containsKey(JobConstants.PARAM_MIN_SIZE_IN_KB)) {
            try {
                downLimitSize = Long.parseLong(params.get(JobConstants.PARAM_MIN_SIZE_IN_KB));
            } catch (NumberFormatException e) {
                Log.e(TAG, "DOWN-LIMIT-SIZE '" + params.get(JobConstants.PARAM_MIN_SIZE_IN_KB) + "' is not number format!");
            }
        }
        nonAlphaPngList = new ArrayList<Pair<String, Long>>();
        entrySizeMap = config.getEntrySizeMap();
        entryNameMap = config.getEntryNameMap();
    }

View on GitHub (pinned to 3b8293bd65)