Tencent/matrix · error · TaskInitException

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

Error message

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

What it means

MultiLibCheckTask.init() checks for native libraries that are linked against multiple STLs; it needs config.getUnzipPath() to locate the "lib" directory. If the unzip path is null/empty it throws TaskInitException with this message.

Solutions

  1. Set config.setUnzipPath(...) to the unzipped APK directory before this task runs.
  2. Ensure the unzip task completed successfully and produced a lib/ subdirectory.
  3. Verify the config object is shared/populated for all tasks, not only some.

Example fix

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

Strategy: validation

Validate before calling

String p = config.getUnzipPath();
if (p == null || p.isEmpty() || !new File(p, "lib").exists()) {
    throw new IllegalStateException("unzip path with lib/ required for MultiLibCheckTask");
}

Try / catch

try {
    task.init();
} catch (TaskInitException e) {
    if (e.getMessage().contains("can not be null")) {
        // skip native-lib checks or fix config, then rerun
    }
}

Prevention

When it happens

Trigger: Running MultiLibCheckTask with an ApkDetector/JobConfig whose unzip path was never set or is an empty string, so new File(inputPath, "lib") cannot be constructed.

Common situations: Same config mistakes as other apk-canary tasks: forgetting setUnzipPath(), upstream unzip task skipped or failed, params not plumbed through Gradle/CLI configuration.

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

Appendix: source

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

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

    private File libDir;

    public MultiLibCheckTask(JobConfig jobConfig, Map<String, String> params) {
        super(jobConfig, params);
        type = TASK_TYPE_CHECK_MULTILIB;
    }

    @Override
    public void init() throws TaskInitException {
        super.init();
        String inputPath = config.getUnzipPath();
        if (!Util.isNullOrNil(inputPath)) {
            Log.i(TAG, "inputPath:%s", inputPath);
            libDir = new File(inputPath, "lib");
        } else {
            throw new TaskInitException(TAG + "---APK-UNZIP-PATH can not be null!");
        }
    }

    @Override
    public TaskResult call() throws TaskExecuteException {
        try {
            TaskResult taskResult = TaskResultFactory.factory(getType(), TASK_RESULT_TYPE_JSON, config);
            if (taskResult == null) {
                return null;
            }
            long startTime = System.currentTimeMillis();
            JsonArray jsonArray = new JsonArray();
            if (libDir.exists() && libDir.isDirectory()) {
                File[] dirs = libDir.listFiles();
                for (File dir : dirs) {
                    if (dir.isDirectory()) {
                        jsonArray.add(dir.getName());
                    }

View on GitHub (pinned to 3b8293bd65)