{"record":{"id":"78f4a84c41a13141","repo":"Tencent/matrix","slug":"need-zip-align-apk-but-the-path-of-zipalign-is-not","errorCode":null,"errorMessage":"Need zip align apk but the path of zipalign is not specified!","messagePattern":"Need zip align apk but the path of zipalign is not specified!","errorType":"exception","errorClass":"GradleException","httpStatus":null,"severity":"error","filePath":"matrix/matrix-android/matrix-gradle-plugin/src/main/kotlin/com/tencent/matrix/plugin/task/RemoveUnusedResourcesTaskV2.kt","lineNumber":483,"sourceCode":"            }\n        }\n    }\n\n    private fun parametersInvalidation() {\n\n        // Validate path of ApkChecker tool\n        if (!Util.isNullOrNil(pathOfApkChecker)) {\n            if (!File(pathOfApkChecker).exists()) {\n                throw GradleException(\"the path of Matrix-ApkChecker $pathOfApkChecker is not exist!\")\n            }\n        } else {\n            throw GradleException(\"the path of Matrix-ApkChecker not found!\")\n        }\n\n        // Validate path of Zipalign tool\n        if (isZipAlignEnabled) {\n            if (Util.isNullOrNil(pathOfZipAlign)) {\n                throw GradleException(\"Need zip align apk but the path of zipalign is not specified!\")\n            } else if (!File(pathOfZipAlign).exists()) {\n                throw GradleException(\"Need zipalign apk but $pathOfZipAlign is not exist!\")\n            }\n        }\n\n        // Validate path of signing\n        if (isSigningEnabled) {\n            if (Util.isNullOrNil(pathOfApkSigner)) {\n                throw GradleException(\"Need signing apk but the path of apksigner is not specified!\")\n            } else if (!File(pathOfApkSigner).exists()) {\n                throw GradleException(\"Need signing apk but $pathOfApkSigner is not exist!\")\n            } else if (AgpCompat.getSigningConfig(variant) == null) {\n                throw GradleException(\"Need signing apk but signingConfig is not specified!\")\n            }\n        }\n    }\n\n    private fun calculateResources(","sourceCodeStart":465,"sourceCodeEnd":501,"githubUrl":"https://github.com/Tencent/matrix/blob/3b8293bd65d47eeea7caf1f32a3a5d4d5eab60e7/matrix/matrix-android/matrix-gradle-plugin/src/main/kotlin/com/tencent/matrix/plugin/task/RemoveUnusedResourcesTaskV2.kt#L465-L501","documentation":"Thrown by RemoveUnusedResourcesTaskV2.parametersInvalidation during Gradle parameter validation. The task is configured to zip-align the resulting APK (isZipAlignEnabled=true) but no path to the zipalign tool was provided, so it aborts before doing any work via GradleException. The zipalign binary is required to align the uncompressed entries of the APK before it can be shipped.","triggerScenarios":"Running the removeUnusedResources task with matrix removeResourceConfig zipAlignEnabled = true while the extension property zipAlignPath (pathOfZipAlign) is left null/empty.","commonSituations":"Developers enable zipAlign in the Matrix config but forget to point zipAlignPath at the Android SDK build-tools zipalign binary (e.g. $ANDROID_HOME/build-tools/<version>/zipalign); also common on CI machines where build-tools versions changed and the hardcoded path is stale.","solutions":["Set matrix { removeResourceConfig { zipAlignPath = \"/path/to/android-sdk/build-tools/<ver>/zipalign\" } } in build.gradle.","Or set zipAlignEnabled = false if alignment is not required for this build.","Verify the path resolves on the build machine (CI may have a different SDK layout); prefer locating it dynamically from android.sdkDirectory/build-tools."],"exampleFix":"// before\nmatrix {\n  removeResourceConfig {\n    zipAlignEnabled = true\n  }\n}\n// after\nmatrix {\n  removeResourceConfig {\n    zipAlignEnabled = true\n    zipAlignPath = \"${android.sdkDirectory}/build-tools/33.0.1/zipalign\"\n  }\n}","handlingStrategy":"validation","validationCode":"def cfg = matrix.extensions.findByName('matrix')?.removeResourceConfig\nif (cfg?.zipAlignEnabled && (cfg.zipAlignPath == null || cfg.zipAlignPath.trim().isEmpty())) {\n  throw new GradleException(\"zipAlignEnabled requires zipAlignPath to be set\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pair zipAlignEnabled=true with a zipAlignPath derived from android.sdkDirectory.","Add a settings-check Gradle task that validates Matrix config early in the build.","Document required Matrix paths in the project's build conventions file."],"tags":["gradle","android","missing-config-value","build-tool"],"backgroundTag":"missing-config-value","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"}