{"record":{"id":"d0698a7e82bd8029","repo":"Tencent/matrix","slug":"need-sign-apk-but-signingconfig-not-found","errorCode":null,"errorMessage":"need sign apk but signingConfig not found!","messagePattern":"need sign apk but signingConfig not found!","errorType":"exception","errorClass":"GradleException","httpStatus":null,"severity":"error","filePath":"matrix/matrix-android/matrix-gradle-plugin/src/main/kotlin/com/tencent/matrix/plugin/task/RemoveUnusedResourcesTask.kt","lineNumber":132,"sourceCode":"                resourceName = \"R.$typeName.$resName\"\n            }\n        }\n        return resourceName\n    }\n\n    private fun removeUnusedResources(\n            originalApk: String,\n            rTxtFile: String,\n            signingConfig: SigningConfig?) {\n\n        // Check configurations\n        if (needSign) {\n            if (Util.isNullOrNil(apksigner)) {\n                throw GradleException(\"need sign apk but apksigner not found!\");\n            } else if (!File(apksigner).exists()) {\n                throw GradleException(\"need sign apk but apksigner $apksigner was not exist!\");\n            } else if (signingConfig == null) {\n                throw GradleException(\"need sign apk but signingConfig not found!\");\n            }\n        }\n\n        var zipOutputStream: ZipOutputStream? = null\n\n        try {\n            try {\n                val inputFile = File(originalApk)\n\n                for (res in ignoreRes) {\n                    ignoreResources.add(Util.globToRegexp(res))\n                }\n\n                val iterator = unusedResources.iterator()\n                while (iterator.hasNext()) {\n                    val res = iterator.next()\n                    if (ignoreResource(res)) {\n                        iterator.remove()","sourceCodeStart":114,"sourceCodeEnd":150,"githubUrl":"https://github.com/Tencent/matrix/blob/3b8293bd65d47eeea7caf1f32a3a5d4d5eab60e7/matrix/matrix-android/matrix-gradle-plugin/src/main/kotlin/com/tencent/matrix/plugin/task/RemoveUnusedResourcesTask.kt#L114-L150","documentation":"When signing is required (`needSign = true`), the task needs both the apksigner tool and the corresponding `SigningConfig` from the Android build (key store, alias, passwords) to pass to apksigner. This error is thrown when apksigner is configured but the signingConfig parameter is null, meaning the build variant has no signing configuration to use.","triggerScenarios":"`needSign = true` with a valid `apksigner` path, but the resolved variant's `signingConfig` is null — i.e. the app module has no `signingConfig` assigned to the buildType being built.","commonSituations":"Building a release variant that has no `signingConfig signingConfigs.release` line; using the debug buildType without a signingConfig; typos in the signingConfigs block so the config is never attached.","solutions":["Define a `signingConfigs { ... }` block in the app module and assign it to the buildType: `buildTypes { release { signingConfig signingConfigs.release } }`.","Ensure the variant Matrix processes actually references that signingConfig (check `android.signingConfigs` and the variant's config).","Set `needSign = false` in the matrix extension if you sign the APK manually afterwards."],"exampleFix":"// before\nandroid {\n  buildTypes { release { minifyEnabled true } } // no signingConfig\n}\n\n// after\nandroid {\n  signingConfigs { release { storeFile file(\"keystore.jks\"); storePassword \"...\"; keyAlias \"...\"; keyPassword \"...\" } }\n  buildTypes { release { signingConfig signingConfigs.release } }\n}","handlingStrategy":"validation","validationCode":"android {\n  signingConfigs { release { storeFile file('keystore.jks'); storePassword '...'; keyAlias '...'; keyPassword '...' } }\n  buildTypes { release { signingConfig signingConfigs.release } }\n}\nassert android.buildTypes.release.signingConfig != null : 'release signingConfig required for matrix needSign'","typeGuard":null,"tryCatchPattern":"try { ... } catch (GradleException e) { if (e.message.contains('signingConfig not found')) { logger.error('Assign signingConfig to the buildType') } throw e }","preventionTips":["Attach a signingConfig to every buildType Matrix processes.","Keep keystore credentials in gradle.properties or env vars, not skipped entirely.","Disable needSign if signing is handled in a separate CI step."],"tags":["gradle","android","signing","missing-config-value"],"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"}