Tencent/matrix · error · TaskInitException
---APK-UNZIP-PATH ' ' is not exist!
Error message
---APK-UNZIP-PATH '<inputPath>' is not exist!
What it means
In MethodCountTask.init(), after a non-empty unzip path is obtained, a File is created and checked with exists(). If the path does not exist on disk, init throws TaskInitException with this message. It guards against pointing the method-count analysis at a missing directory.
Solutions
- Verify the configured unzip path exists (File.exists() in a pre-check or ls the directory) before running the task.
- Fix the path string to the actual directory of the unzipped APK.
- Re-run the unzip step to regenerate the directory if it was removed.
Example fix
// before
config.setUnzipPath("/tmp/build/apk_unzipped"); // directory never created
// after
File dir = new File("/tmp/build/apk_unzipped");
if (dir.exists() && dir.isDirectory()) {
config.setUnzipPath(dir.getAbsolutePath());
} Defensive patterns
Strategy: validation
Validate before calling
File dir = new File(config.getUnzipPath());
if (!dir.exists()) {
throw new IllegalStateException("unzip path does not exist: " + dir.getAbsolutePath());
} Try / catch
try {
task.init();
} catch (TaskInitException e) {
if (e.getMessage().contains("is not exist")) {
// re-run unzip step, then retry task
}
} Prevention
- Unzip the APK and verify the output directory exists before running apk-canary tasks.
- Use absolute paths to avoid working-directory surprises.
- Do not clean shared temp directories while a check pipeline is running.
When it happens
Trigger: config.getUnzipPath() returns a non-empty path, but new File(inputPath).exists() is false — i.e. the directory was deleted, never created, or the path is misspelled when MethodCountTask.init() runs.
Common situations: Typos in the configured path; unzipped output cleaned by a build between tasks; running on a machine/container where the unzip output was never produced; relative path resolved against an unexpected working directory.
Understand the failure class
Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.
Related errors
- ---APK-UNZIP-PATH ' ' is not directory!
- ---APK-UNZIP-PATH can not be null!
- TAG + "---The path of tool 'nm' is not given!"
- TAG + "---APK-UNZIP-PATH can not be null!"
- TAG + "---APK-FILE-PATH can not be null!"
AI-assisted analysis of Tencent/matrix@3b8293bd65 (2026-09-08).
Data as JSON: /api/errors/126f0fd6d443c61a.
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:90
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);
}
}
}
} catch (FileNotFoundException e) {
throw new TaskInitException(e.getMessage(), e);
}
if (params.containsKey(JobConstants.PARAM_GROUP)) {View on GitHub (pinned to 3b8293bd65)