Tencent/matrix · error · TaskInitException
---APK-UNZIP-PATH can not be null!
Error message
---APK-UNZIP-PATH can not be null!
What it means
MethodCountTask.init() validates its configuration before running the APK method-count analysis. It throws TaskInitException with this message when config.getUnzipPath() returns null or an empty string. The task needs the directory of the already-unzipped APK to find .dex files, so without a path it cannot proceed.
Solutions
- Set the unzip path on the job config (e.g. config.setUnzipPath(...)) pointing to the directory produced by unzipping the APK before running MethodCountTask.
- Run/verify the APK unzip task completes first so the path is populated.
- Check that upstream parameter plumbing (CLI args, JobConstants params) actually passes the path into the config.
Example fix
// before
JobConfig config = new JobConfig();
// unzip path never set
// after
JobConfig config = new JobConfig();
config.setUnzipPath("/tmp/build/apk-unzipped"); Defensive patterns
Strategy: validation
Validate before calling
if (config == null || config.getUnzipPath() == null || config.getUnzipPath().isEmpty()) {
throw new IllegalStateException("unzip path must be set before running MethodCountTask");
} Try / catch
try {
task.init();
} catch (TaskInitException e) {
if (e.getMessage().contains("can not be null")) {
// abort pipeline: configuration is incomplete
}
} Prevention
- Always call setUnzipPath() before adding tasks to the checker job.
- Assert config completeness with a unit test for your pipeline setup.
- Fail fast at job start: validate all required config fields once.
When it happens
Trigger: Calling MethodCountTask (via Matrix APM checker job) with an ApkDetector/JobConfig whose unzip path was never set, or set to null/empty string, before task execution.
Common situations: Forgetting to call setUnzipPath()/configure the unzip step before the checker pipeline runs; a preceding unzip task failed silently leaving the path empty; programmatic configuration built from missing CLI/Gradle parameters.
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 can not be null!
- ---APK-UNZIP-PATH ' ' is not exist!
- ---APK-UNZIP-PATH ' ' is not directory!
- ---APK-UNZIP-PATH can not be null!
- ---APK-UNZIP-PATH can not be null!
AI-assisted analysis of Tencent/matrix@3b8293bd65 (2026-09-08).
Data as JSON: /api/errors/eb3cbffdb96a990a.
Report an issue: GitHub.
Appendix: source
Thrown at matrix/matrix-android/matrix-apk-canary/src/main/java/com/tencent/matrix/apk/model/task/MethodCountTask.java:85
private final Map<String, Integer> pkgExternalMethod;
public MethodCountTask(JobConfig config, Map<String, String> params) {
super(config, params);
type = TASK_TYPE_COUNT_METHOD;
dexFileNameList = new ArrayList<String>();
dexFileList = new ArrayList<RandomAccessFile>();
classInternalMethod = new HashMap<String, Integer>();
classExternalMethod = new HashMap<String, Integer>();
pkgInternalRefMethod = new HashMap<String, Integer>();
pkgExternalMethod = new HashMap<String, Integer>();
}
@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!");
} else 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());
RandomAccessFile randomAccessFile = new RandomAccessFile(file, "rw");
dexFileList.add(randomAccessFile);
}
}View on GitHub (pinned to 3b8293bd65)