{"record":{"id":"856ca04b5d4e80da","repo":"Tencent/matrix","slug":"need-signing-apk-but-signingconfig-is-not-specifie","errorCode":null,"errorMessage":"Need signing apk but signingConfig is not specified!","messagePattern":"Need signing apk but signingConfig 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":496,"sourceCode":"        }\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(\n            setOfUnusedResources: Set<String>,\n            mapOfDuplicatedResources: Map<String, MutableSet<String>>,\n            mapOfResources: MutableMap<String, Int>,\n            resultOfResourcesGonnaRemoved: MutableMap<String, Int>,\n            resultOfDuplicatesReplacements: MutableMap<String, String>,\n            resultOfObfuscatedNames: MutableMap<String, String>\n    ) {\n\n        // Prepare unused resources\n        val regexpRules = HashSet<String>()\n        for (res in rulesOfIgnore) {\n            regexpRules.add(Util.globToRegexp(res))\n        }","sourceCodeStart":478,"sourceCodeEnd":514,"githubUrl":"https://github.com/Tencent/matrix/blob/3b8293bd65d47eeea7caf1f32a3a5d4d5eab60e7/matrix/matrix-android/matrix-gradle-plugin/src/main/kotlin/com/tencent/matrix/plugin/task/RemoveUnusedResourcesTaskV2.kt#L478-L514","documentation":"Thrown by RemoveUnusedResourcesTaskV2.parametersInvalidation when signing is enabled, apksigner exists, but the variant's signingConfig is null (AgpCompat.getSigningConfig(variant) == null). apksigner needs a keystore/alias/password configuration to re-sign, so the task aborts.","triggerScenarios":"Running removeUnusedResources on a variant (commonly debug or a custom variant) whose buildType has no signingConfig set, while useApkSign=true in the Matrix config.","commonSituations":"Debug variants without a custom signing config; release builds built before adding signingConfig blocks; flavors that override buildTypes and drop signingConfig.","solutions":["Add a signingConfig to the variant: android { signingConfigs { release { ... } } buildTypes { release { signingConfig signingConfigs.release } } }.","Or run the task only on variants that have a signingConfig.","Or set useApkSign = false if the APK is signed in a later pipeline step."],"exampleFix":"// before\nandroid {\n  buildTypes {\n    release {\n      minifyEnabled true // no signingConfig\n    }\n  }\n}\n// after\nandroid {\n  signingConfigs {\n    release {\n      storeFile file(\"release.keystore\")\n      storePassword \"...\"\n      keyAlias \"...\"\n      keyPassword \"...\"\n    }\n  }\n  buildTypes {\n    release {\n      signingConfig signingConfigs.release\n    }\n  }\n}","handlingStrategy":"validation","validationCode":"android.applicationVariants.all { v ->\n  if (v.buildType.signingConfig == null) {\n    logger.warn(\"Variant ${v.name} has no signingConfig; removeUnusedResources with useApkSign will fail\")\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Ensure every build type that runs removeUnusedResources has a signingConfig assigned.","Flavors overriding buildTypes must not drop signingConfig.","Run the task only on release-like variants with signing configured."],"tags":["gradle","android","signing","missing-config-value"],"backgroundTag":"missing-required-config","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"}