Tencent/matrix · error · TaskInitException
---APK-UNZIP-PATH can not be null!
Error message
---APK-UNZIP-PATH can not be null!
What it means
CountClassTask counts classes in an unzipped APK directory. After the base init() checks, it reads config.getUnzipPath(); if that path is null or empty (Util.isNullOrNil) it throws TaskInitException with this message, because the task cannot operate without the directory containing the extracted APK contents.
Solutions
- Set the APK-UNZIP-PATH config value (config.setUnzipPath(...) / job config property) to the directory of the unzipped APK before running the task.
- Run the unzip step of the canary job first and feed its output path into the config.
- Check the property name in your gradle/config file for typos or missing values.
- Validate config.getUnzipPath() in your build script before invoking the matrix APK checker.
Example fix
// before JobConfig config = new JobConfig(); task.setConfig(config); // after JobConfig config = new JobConfig(); config.setUnzipPath(unzipDir.getAbsolutePath()); task.setConfig(config);
Defensive patterns
Strategy: validation
Validate before calling
String unzipPath = config.getUnzipPath();
if (unzipPath == null || unzipPath.trim().isEmpty()) {
throw new IllegalStateException("APK-UNZIP-PATH must be set before running CountClassTask");
} Type guard
boolean hasUnzipPath(JobConfig config) {
String p = config == null ? null : config.getUnzipPath();
return p != null && !p.trim().isEmpty();
} Try / catch
try {
countClassTask.init();
countClassTask.execute();
} catch (TaskInitException e) {
MatrixLog.e(TAG, "unzip path misconfigured: %s", e.getMessage());
throw e;
} Prevention
- Always run and complete the unzip step before check tasks.
- Set the unzip path via absolute File path, not ad-hoc strings.
- Validate the config (path non-empty, directory exists) in your Gradle plugin before the job.
- Keep config keys consistent; avoid hand-typed property names.
When it happens
Trigger: Running CountClassTask with a JobConfig whose 'APK-UNZIP-PATH' (unzipPath) was never set, or set to an empty string, before execute()/init().
Common situations: Forgot to call the unzip step of the APK canary pipeline so no path was recorded in the config; Gradle plugin passes an empty property when the APK input wasn't resolved; typo in the config property key so the unzip path defaults to null.
Understand the failure class
Background: "missing required config value" errors: why libraries refuse to start when a configuration key is empty, unset, or blank — this error's family across 48 libraries.
Related errors
- ---APK-UNZIP-PATH can not be null!
- ---jobConfig can not be null!
- ---APK-UNZIP-PATH ' ' is not exist!
- ---APK-UNZIP-PATH ' ' is not directory!
- ---APK-UNZIP-PATH ' ' is not exist!
AI-assisted analysis of Tencent/matrix@3b8293bd65 (2026-09-08).
Data as JSON: /api/errors/1ab310f2ae4ad152.
Report an issue: GitHub.
Appendix: source
Thrown at matrix/matrix-android/matrix-apk-canary/src/main/java/com/tencent/matrix/apk/model/task/CountClassTask.java:74
private File inputFile;
private String group = JobConstants.GROUP_PACKAGE;
private final List<String> dexFileNameList;
private final List<RandomAccessFile> dexFileList;
public CountClassTask(JobConfig config, Map<String, String> params) {
super(config, params);
type = TASK_TYPE_COUNT_CLASS;
dexFileNameList = new ArrayList<>();
dexFileList = new ArrayList<>();
}
@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, "input path:%s", inputPath);
inputFile = new File(inputPath);
if (!inputFile.exists()) {
throw new TaskInitException(TAG + "---APK-UNZIP-PATH '" + inputPath + "' is not exist!");
}
if (!inputFile.isDirectory()) {
throw new TaskInitException(TAG + "---APK-UNZIP-PATH '" + inputPath + "' is not directory!");
}
File[] files = inputFile.listFiles();
try {
if (files != null) {
for (File file : files) {
if (file.isFile() && file.getName().endsWith(ApkConstants.DEX_FILE_SUFFIX)) {
dexFileNameList.add(file.getName());View on GitHub (pinned to 3b8293bd65)