Tencent/matrix · error · TaskInitException
TAG + "---APK-UNZIP-PATH '" + inputPath + "' is not…
Error message
TAG + "---APK-UNZIP-PATH '" + inputPath + "' is not directory!"
What it means
Thrown from UnusedAssetsTask.init() when the configured unzip path exists but is not a directory. The task scans the extracted APK's assets directory for unused asset files, so a non-directory path (e.g. the APK file itself) is rejected with TaskInitException during initialization.
Solutions
- Point APK-UNZIP-PATH at the extracted directory, not the .apk file.
- If the path is the APK, move that value to APK-FILE-PATH and run the unzip task.
- Add a pre-run check that new File(unzipPath).isDirectory().
Example fix
// before
config.setApkUnzipPath("app-release.apk"); // wrong key usage
// after
config.setApkPath("app-release.apk");
config.setApkUnzipPath("build/unzipped-apk"); // extracted directory Defensive patterns
Strategy: validation
Validate before calling
File f = new File(unzipPath);
if (f.exists() && !f.isDirectory()) {
throw new IllegalStateException("APK-UNZIP-PATH must be a directory, got a file: " + unzipPath);
} Type guard
boolean isDirectory(File f) { return f != null && f.isDirectory(); } Try / catch
try {
job.run();
} catch (TaskInitException e) {
if (e.getMessage().contains("is not directory")) {
log.error("'{}' is the APK file, not the unzipped dir; fix APK-FILE-PATH vs APK-UNZIP-PATH", unzipPath);
} else throw e;
} Prevention
- Don't swap the APK-FILE-PATH and APK-UNZIP-PATH config values.
- Ensure unzip actually extracts (not just copies the archive).
- Assert isDirectory() on the unzip output before analysis tasks.
- Standardize unzip output into a fixed build/ subdirectory.
When it happens
Trigger: Passing the .apk file itself instead of the unzipped directory to APK-UNZIP-PATH; unzip produced a single archive file instead of an extracted tree.
Common situations: Config mix-up between APK-FILE-PATH and APK-UNZIP-PATH keys; unzip step misconfigured to keep the zip instead of extracting.
Related errors
- 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!"
- TAG + "---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/cffbae579a2ff250.
Report an issue: GitHub.
Appendix: source
Thrown at matrix/matrix-android/matrix-apk-canary/src/main/java/com/tencent/matrix/apk/model/task/UnusedAssetsTask.java:84
dexFileNameList = new ArrayList<>();
ignoreSet = new HashSet<>();
assetsPathSet = new HashSet<>();
assetRefSet = new HashSet<>();
}
@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 exist!");
} else if (!inputFile.isDirectory()) {
throw new TaskInitException(TAG + "---APK-UNZIP-PATH '" + inputPath + "' is not directory!");
}
if (params.containsKey(JobConstants.PARAM_IGNORE_ASSETS_LIST) && !Util.isNullOrNil(params.get(JobConstants.PARAM_IGNORE_ASSETS_LIST))) {
String[] ignoreAssets = params.get(JobConstants.PARAM_IGNORE_ASSETS_LIST).split(",");
Log.i(TAG, "ignore assets %d", ignoreAssets.length);
for (String ignore : ignoreAssets) {
ignoreSet.add(Util.globToRegexp(ignore));
}
}
File[] files = inputFile.listFiles();
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)