Tencent/matrix · error · TaskInitException
---APK-UNZIP-PATH can not be null!
Error message
---APK-UNZIP-PATH can not be null!
What it means
Matrix APK Checker's DuplicateFileTask throws TaskInitException during init() when config.getUnzipPath() is null or empty. Every check task requires an unzipped APK directory to scan for duplicate resources (same MD5). init() runs before the task executes, so missing configuration fails fast.
Solutions
- Pass the unzip path: add '--unzip <dir-of-unzipped-apk>' to the ApkChecker invocation or set config.setUnzipPath(path) before running.
- Ensure the unzip step runs before DuplicateFileTask (e.g. UnzipTask output feeds this config).
- Log/verify config.getUnzipPath() right before task initialization to confirm it is populated.
Example fix
// before
ApkChecker.run(new JobConfig(...)); // no unzip path set
// after
JobConfig config = new JobConfig();
config.setUnzipPath("/build/apk-unzipped/"); // must be non-null, non-empty
ApkChecker.run(config); 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 DuplicateFileTask");
} Try / catch
try {
task.init();
} catch (TaskInitException e) {
if (e.getMessage().contains("APK-UNZIP-PATH can not be null")) {
config.setUnzipPath(defaultUnzipDir);
}
} Prevention
- Always call setUnzipPath() (or pass --unzip) before enabling any check task.
- Run UnzipTask first in the task pipeline and feed its output path into config.
- Add a CI assertion that the unzip path is non-empty before invoking ApkChecker.
When it happens
Trigger: Running DuplicateFileTask (as part of ApkCheckTask/task list via ApkChecker) with a JobConfig whose PARAM_UNZIP_PATH is not set, or set to null/empty string.
Common situations: Forgetting the '--unzip <path>' CLI argument when invoking ApkChecker; programmatically building TaskConfig without calling setUnzipPath; a prior unzip step failing silently so the path was never populated.
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
- ---APK-UNZIP-PATH ' 'is not exists!
- ---APK-UNZIP-PATH ' ' is not directory!
- ---APK-UNZIP-PATH can not be null!
- ---APK-UNZIP-PATH can not be null!
- ---APK-UNZIP-PATH ' 'is not exists!
AI-assisted analysis of Tencent/matrix@3b8293bd65 (2026-09-08).
Data as JSON: /api/errors/5d9603bc75fa692a.
Report an issue: GitHub.
Appendix: source
Thrown at matrix/matrix-android/matrix-apk-canary/src/main/java/com/tencent/matrix/apk/model/task/DuplicateFileTask.java:67
private static final String TAG = "Matrix.DuplicateFileTask";
private File inputFile;
private Map<String, List<String>> md5Map;
private List<Pair<String, Long>> fileSizeList;
private Map<String, Pair<Long, Long>> entrySizeMap;
private Map<String, String> entryNameMap;
public DuplicateFileTask(JobConfig config, Map<String, String> params) {
super(config, params);
type = TaskFactory.TASK_TYPE_DUPLICATE_FILE;
}
@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!");
}
md5Map = new HashMap<>();
fileSizeList = new ArrayList<>();
entrySizeMap = config.getEntrySizeMap();
entryNameMap = config.getEntryNameMap();
}
private void computeMD5(File file) throws NoSuchAlgorithmException, IOException {
if (file != null) {
if (file.isDirectory()) {
File[] files = file.listFiles();
for (File resFile : files) {View on GitHub (pinned to 3b8293bd65)