Tencent/matrix · error · TaskInitException
---APK-UNZIP-PATH ' ' is not exist!
Error message
---APK-UNZIP-PATH '<inputPath>' is not exist!
What it means
Thrown from UnusedResourcesTask.init() when the configured unzip path is non-empty but the directory does not exist on disk. The task correlates R.txt references with resources in the extracted APK tree, so a missing directory fails initialization with TaskInitException — usually a stale or wrong path.
Solutions
- Run the unzip task / extract the APK before UnusedResourcesTask and pass that output directory as unzip path
- Pass the extracted directory, not the .apk file
- Verify the path exists on the machine running the check
Example fix
// before
config.setUnzipPath("/ci/workspace/app-release.apk");
// after
config.setUnzipPath("/ci/workspace/apk-extracted"); // directory produced by unzip step Defensive patterns
Strategy: validation
Validate before calling
File dir = new File(config.getUnzipPath());
if (!dir.exists()) throw new IllegalStateException("unzip dir does not exist: " + dir); Try / catch
try {
task.init();
} catch (TaskInitException e) {
log.error("unzip path missing: " + e.getMessage());
} Prevention
- Run unzip/extraction before resource analysis
- Verify paths on the executing machine (CI vs local differ)
- Extract to a deterministic directory under build/
When it happens
Trigger: config.getUnzipPath() set to a path that was never created, deleted by clean, or extracted after the task config was built.
Common situations: Running the check before the unzip task, pointing at the .apk file instead of the extracted directory, or typo'd absolute paths on CI.
Related errors
- ---APK-UNZIP-PATH ' ' is not directory!
- e.getMessage()
- TAG + "---APK-UNZIP-PATH can not be null!"
- TAG + "---The File 'R.txt' can not be null!"
- ---The Resource declarations file 'R.txt' is not legal!
AI-assisted analysis of Tencent/matrix@3b8293bd65 (2026-09-08).
Data as JSON: /api/errors/ee8ebffa0e89f992.
Report an issue: GitHub.
Appendix: source
Thrown at matrix/matrix-android/matrix-apk-canary/src/main/java/com/tencent/matrix/apk/model/task/UnusedResourcesTask.java:116
@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!");
}
if (!params.containsKey(JobConstants.PARAM_R_TXT) || Util.isNullOrNil(params.get(JobConstants.PARAM_R_TXT))) {
throw new TaskInitException(TAG + "---The File 'R.txt' can not be null!");
}
resourceTxt = new File(params.get(JobConstants.PARAM_R_TXT));
if (!FileUtil.isLegalFile(resourceTxt)) {
throw new TaskInitException(TAG + "---The Resource declarations file 'R.txt' is not legal!");
}
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 (!Util.isNullOrNil(config.getMappingFilePath())) {
mappingTxt = new File(config.getMappingFilePath());
if (!FileUtil.isLegalFile(mappingTxt)) {
throw new TaskInitException(TAG + "---The Proguard mapping file 'mapping.txt' is not legal!");
}
}
if (params.containsKey(JobConstants.PARAM_IGNORE_RESOURCES_LIST) && !Util.isNullOrNil(params.get(JobConstants.PARAM_IGNORE_RESOURCES_LIST))) {
String[] ignoreRes = params.get(JobConstants.PARAM_IGNORE_RESOURCES_LIST).split(",");
for (String ignore : ignoreRes) {
ignoreSet.add(Util.globToRegexp(ignore));
}
}
if (!Util.isNullOrNil(config.getResMappingFilePath())) {
resMappingTxt = new File(config.getResMappingFilePath());
if (!FileUtil.isLegalFile(resMappingTxt)) {View on GitHub (pinned to 3b8293bd65)