Tencent/matrix · error · GradleException

the path of Matrix-ApkChecker $pathOfApkChecker is not…

Error message

the path of Matrix-ApkChecker $pathOfApkChecker is not exist!

What it means

Before running, the V2 task validates its tool parameters in `parametersInvalidation`. If `pathOfApkChecker` is non-empty but the file is not present on disk, the task throws with the configured path embedded in the message. ApkChecker is mandatory for this task, so a bad path aborts the build.

Solutions

  1. Set `pathOfApkChecker` to the existing Matrix-ApkChecker jar path (e.g. `.../matrix/apkchecker/apkchecker.jar`) and confirm with `ls`.
  2. Download/copy the Matrix ApkChecker artifact for your Matrix version into the configured location.
  3. Ensure the path points to the jar file itself, not its containing directory.
  4. If you only want unused-resource removal without checker analysis, use RemoveUnusedResourcesTask (V1) which doesn't require ApkChecker.

Example fix

// before
pathOfApkChecker = "/libs/apkchecker-0.6.5.jar" // deleted

// after
pathOfApkChecker = "/opt/matrix/matrix-apk-checker-1.0.0.jar" // confirmed on disk
Defensive patterns

Strategy: validation

Validate before calling

def checker = new File(ext.pathOfApkChecker)
assert checker.exists() && checker.isFile() : "ApkChecker missing at ${checker}"

Type guard

def apkCheckerExists = { String p -> p != null && new File(p).isFile() }

Try / catch

try { ... } catch (GradleException e) { if (e.message.contains('ApkChecker') && e.message.contains('is not exist')) { logger.error('Fix pathOfApkChecker: ' + e.message) } throw e }

Prevention

When it happens

Trigger: `pathOfApkChecker` set to a non-empty string that fails `File(...).exists()` when the task's `parametersInvalidation` runs at task execution.

Common situations: Path copied from another machine/CI; apkchecker jar deleted during clean; using a directory path instead of the jar file; renamed artifact after a Matrix version upgrade.

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


AI-assisted analysis of Tencent/matrix@3b8293bd65 (2026-09-08). Data as JSON: /api/errors/2c96bd062ae987cf. Report an issue: GitHub.

Appendix: source

Thrown at matrix/matrix-android/matrix-gradle-plugin/src/main/kotlin/com/tencent/matrix/plugin/task/RemoveUnusedResourcesTaskV2.kt:474

                            val md5 = obj.get("md5")
                            resultOfDuplicates[md5.toString()] = HashSet()
                            val fileList = obj.get("files").asJsonArray
                            for (m in 0 until fileList.size()) {
                                resultOfDuplicates[md5.toString()]?.add(fileList.get(m).asString)
                            }
                        }
                    }
                }
            }
        }
    }

    private fun parametersInvalidation() {

        // Validate path of ApkChecker tool
        if (!Util.isNullOrNil(pathOfApkChecker)) {
            if (!File(pathOfApkChecker).exists()) {
                throw GradleException("the path of Matrix-ApkChecker $pathOfApkChecker is not exist!")
            }
        } else {
            throw GradleException("the path of Matrix-ApkChecker not found!")
        }

        // Validate path of Zipalign tool
        if (isZipAlignEnabled) {
            if (Util.isNullOrNil(pathOfZipAlign)) {
                throw GradleException("Need zip align apk but the path of zipalign is not specified!")
            } else if (!File(pathOfZipAlign).exists()) {
                throw GradleException("Need zipalign apk but $pathOfZipAlign is not exist!")
            }
        }

        // Validate path of signing
        if (isSigningEnabled) {
            if (Util.isNullOrNil(pathOfApkSigner)) {
                throw GradleException("Need signing apk but the path of apksigner is not specified!")

View on GitHub (pinned to 3b8293bd65)