{"record":{"id":"88b1657dfd26bc52","repo":"Tencent/matrix","slug":"config-getapkpath-is-not-exist","errorCode":null,"errorMessage":"---'<config.getApkPath()>' is not exist!","messagePattern":"---'<config\\.getApkPath\\(\\)>' is not exist!","errorType":"exception","errorClass":"TaskInitException","httpStatus":null,"severity":"error","filePath":"matrix/matrix-android/matrix-apk-canary/src/main/java/com/tencent/matrix/apk/model/task/UnzipTask.java","lineNumber":88,"sourceCode":"        super(config, params);\n        type = TASK_TYPE_UNZIP;\n        proguardClassMap = new HashMap<>();\n        resguardMap = new HashMap<>();\n        resDirMap = new HashMap<>();\n        entryNameMap = new HashMap<>();\n        entrySizeMap = new HashMap<>();\n    }\n\n    @Override\n    public void init() throws TaskInitException {\n        super.init();\n        if (Util.isNullOrNil(config.getApkPath())) {\n            throw new TaskInitException(TAG + \"---APK-FILE-PATH can not be null!\");\n        }\n        Log.i(TAG, \"inputPath:%s\", config.getApkPath());\n        inputFile = new File(config.getApkPath());\n        if (!inputFile.exists()) {\n            throw new TaskInitException(TAG + \"---'\" + config.getApkPath() + \"' is not exist!\");\n        }\n        if (Util.isNullOrNil(config.getUnzipPath())) {\n            throw new TaskInitException(TAG + \"---APK-UNZIP-PATH can not be null!\");\n        }\n        Log.i(TAG, \"outputPath:%s\", config.getUnzipPath());\n        outputFile = new File(config.getUnzipPath());\n\n        if (!Util.isNullOrNil(config.getMappingFilePath())) {\n            mappingTxt = new File(config.getMappingFilePath());\n            if (!FileUtil.isLegalFile(mappingTxt)) {\n                throw new TaskInitException(TAG + \"---mapping file \" + config.getMappingFilePath() + \" is not legal!\");\n            }\n        }\n\n        if (!Util.isNullOrNil(config.getResMappingFilePath())) {\n            resMappingTxt = new File(config.getResMappingFilePath());\n            if (!FileUtil.isLegalFile(resMappingTxt)) {\n                throw new TaskInitException(TAG + \"---resguard mapping file \" + config.getResMappingFilePath() + \" is not legal!\");","sourceCodeStart":70,"sourceCodeEnd":106,"githubUrl":"https://github.com/Tencent/matrix/blob/3b8293bd65d47eeea7caf1f32a3a5d4d5eab60e7/matrix/matrix-android/matrix-apk-canary/src/main/java/com/tencent/matrix/apk/model/task/UnzipTask.java#L70-L106","documentation":"UnzipTask.init() checks that the configured APK file exists on disk; if new File(config.getApkPath()).exists() returns false it throws TaskInitException naming the path. The message is templated with the actual configured path at runtime (shown here as <config.getApkPath()>).","triggerScenarios":"config.getApkPath() is non-empty but points to a file that does not exist at the time init() runs.","commonSituations":"Typo in the APK path; the APK build step ran into a different output directory; running the checker before the assemble task produced the APK; relative path resolved from a different working directory in CI.","solutions":["Verify the path in the error message actually exists (ls) and fix the configured path.","Run/depend on the APK assembly task (e.g. assembleRelease) before the ApkCanary check task.","Use an absolute path instead of a relative one to avoid working-directory differences."],"exampleFix":"// before\nconfig.setApkPath(\"app.apk\"); // file not present\n// after\nFile apk = new File(\"app/build/outputs/apk/release/app-release.apk\");\nif (!apk.exists()) throw new IllegalStateException(\"Build APK first\");\nconfig.setApkPath(apk.getAbsolutePath());","handlingStrategy":"validation","validationCode":"File apk = new File(config.getApkPath());\nif (!apk.isFile()) {\n    throw new IllegalArgumentException(\"APK does not exist: \" + apk.getAbsolutePath());\n}","typeGuard":null,"tryCatchPattern":"try {\n    task.init();\n} catch (TaskInitException e) {\n    if (e.getMessage().contains(\"is not exist\")) {\n        throw new GradleException(\"Run assembleRelease before the APK check\", e);\n    }\n    throw e;\n}","preventionTips":["Use absolute paths derived from project layout, not hand-typed strings.","Make the check task depend on the APK-producing task.","Log the resolved APK path in CI before running the checker."],"tags":["apk-canary","file-not-found","configuration"],"backgroundTag":"file-not-found","analyzedSha":"3b8293bd65d47eeea7caf1f32a3a5d4d5eab60e7","analyzedAt":"2026-09-08T08:01:39.722Z","contentChangedAt":"2026-09-08T08:01:39.722Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}