Tencent/matrix · error · GradleException
Need signing apk but the path of apksigner is not specified!
Error message
Need signing apk but the path of apksigner is not specified!
What it means
Thrown by RemoveUnusedResourcesTaskV2.parametersInvalidation when signing is enabled (isSigningEnabled=true) but pathOfApkSigner is null or empty. The task needs the apksigner tool to re-sign the APK after removing resources, so it fails fast with a GradleException.
Solutions
- Set matrix { removeResourceConfig { apksignerPath = "${android.sdkDirectory}/build-tools/<ver>/apksigner" } }.
- Or disable signing (useApkSign = false) if the APK will be signed by another step.
- On CI, ensure the SDK build-tools containing apksigner are installed and reference them dynamically.
Example fix
// before
matrix {
removeResourceConfig {
useApkSign = true
}
}
// after
matrix {
removeResourceConfig {
useApkSign = true
apksignerPath = "${android.sdkDirectory}/build-tools/33.0.1/apksigner"
}
} Defensive patterns
Strategy: validation
Validate before calling
def cfg = matrix.removeResourceConfig
if (cfg?.useApkSign && (cfg.apksignerPath == null || cfg.apksignerPath.trim().isEmpty())) {
throw new GradleException("useApkSign requires apksignerPath")
} Prevention
- Set apksignerPath from ${android.sdkDirectory}/build-tools/<ver>/apksigner rather than by hand.
- Keep signing and tool-path config in a shared convention plugin so all modules get it.
- Verify config completeness in CI before running release builds.
When it happens
Trigger: Configuring matrix removeResourceConfig with useApkSign = true (signing enabled) without setting apksignerPath.
Common situations: Enabling signing for release builds but forgetting the apksigner path; migrating the Matrix config from an older project where the path was set; release-only configuration omitted on CI.
Understand the failure class
Background: "missing required config value" errors: why libraries refuse to start when a configuration key is empty, unset, or blank — this error's family across 48 libraries.
Related errors
- need sign apk but apksigner not found!
- need sign apk but signingConfig not found!
- Need signing apk but signingConfig is not specified!
- apksigner returned with status: $ret
- need sign apk but apksigner $apksigner was not exist!
AI-assisted analysis of Tencent/matrix@3b8293bd65 (2026-09-08).
Data as JSON: /api/errors/7997f948b2d70495.
Report an issue: GitHub.
Appendix: source
Thrown at matrix/matrix-android/matrix-gradle-plugin/src/main/kotlin/com/tencent/matrix/plugin/task/RemoveUnusedResourcesTaskV2.kt:492
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!")
} else if (!File(pathOfApkSigner).exists()) {
throw GradleException("Need signing apk but $pathOfApkSigner is not exist!")
} else if (AgpCompat.getSigningConfig(variant) == null) {
throw GradleException("Need signing apk but signingConfig is not specified!")
}
}
}
private fun calculateResources(
setOfUnusedResources: Set<String>,
mapOfDuplicatedResources: Map<String, MutableSet<String>>,
mapOfResources: MutableMap<String, Int>,
resultOfResourcesGonnaRemoved: MutableMap<String, Int>,
resultOfDuplicatesReplacements: MutableMap<String, String>,
resultOfObfuscatedNames: MutableMap<String, String>
) {
// Prepare unused resourcesView on GitHub (pinned to 3b8293bd65)