Tencent/matrix · error · TaskInitException

TAG + "---APK-UNZIP-PATH can not be null!"

Error message

TAG + "---APK-UNZIP-PATH can not be null!"

What it means

UnStrippedSoCheckTask.init() throws TaskInitException when the unzipped APK directory (config.getUnzipPath(), the APK-UNZIP-PATH config) is null or empty. The task needs the lib/ directory of the unzipped APK to scan .so files.

Solutions

  1. Set the unzip path in MatrixConfig (or the CLI equivalent) to the directory of the unzipped APK before running the job.
  2. Ensure the unzip task runs earlier in the task pipeline so getUnzipPath() is populated.
  3. Verify the unzip output directory actually contains lib/ with .so files.

Example fix

// before
MatrixConfig config = new MatrixConfig.Builder().setApkPath(apk).build();
// after
MatrixConfig config = new MatrixConfig.Builder().setApkPath(apk).setApkUnzipPath(unzipDir).build();
Defensive patterns

Strategy: validation

Validate before calling

String unzipPath = config.getApkUnzipPath();
if (unzipPath == null || unzipPath.isEmpty() || !new File(unzipPath, "lib").isDirectory()) {
    throw new IllegalStateException("APK-UNZIP-PATH missing or has no lib/ dir");
}

Try / catch

try {
    job.run();
} catch (TaskInitException e) {
    if (e.getMessage().contains("APK-UNZIP-PATH can not be null")) {
        runUnzipTaskFirst();
    } else throw e;
}

Prevention

When it happens

Trigger: Launching the so-stripping check job without running the unzip step first, or without setting APK-UNZIP-PATH in the MatrixConfig.

Common situations: Wiring only the APK path but forgetting the unzip path; running UnStrippedSoCheckTask standalone in tests; CI pipeline reordering so the unzip task output dir is not propagated.

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

Appendix: source

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

            while (matcher.find()) {
                if (!Util.isNullOrNil(matcher.group())) {
                    String env = System.getenv(matcher.group().substring(1));
                    Log.d(TAG, "%s -> %s", matcher.group().substring(1), env);
                    if (!Util.isNullOrNil(env)) {
                        toolnmPath = toolnmPath.replace(matcher.group(), env);
                    }
                }
            }
            Log.i(TAG, "toolnm pah is %s", toolnmPath);
        }
        if (!FileUtil.isLegalFile(toolnmPath)) {
            throw new TaskInitException(TAG + "---Can not find the tool 'nm'!");
        }
        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!");
        }

    }

    private boolean isSoStripped(File libFile) throws IOException, InterruptedException {
        ProcessBuilder processBuilder = new ProcessBuilder(toolnmPath, libFile.getAbsolutePath());
        Process process = processBuilder.start();
        BufferedReader reader = new BufferedReader(new InputStreamReader(process.getErrorStream()));
        String line = reader.readLine();
        boolean result = false;
        if (!Util.isNullOrNil(line)) {
            Log.d(TAG, "%s", line);
            String[] columns = line.split(":");
            if (columns.length == 3 && columns[2].trim().equalsIgnoreCase("no symbols")) {
                result = true;
            }
        }
        reader.close();

View on GitHub (pinned to 3b8293bd65)