{"record":{"id":"cf2520382469af10","repo":"Tencent/matrix","slug":"apk-property-not-defined-in-debugstubpropfile","errorCode":null,"errorMessage":"'apk' property not defined in ${debugStubPropFile}","messagePattern":"'apk' property not defined in (.+?)","errorType":"console","errorClass":"GradleScriptException","httpStatus":null,"severity":"error","filePath":"matrix/matrix-android/gradle/WeChatDebugStub2.gradle","lineNumber":42,"sourceCode":"File debugStubPropFile = rootProject.file('debug-stub.properties')\n\ndef minSdk\ndef targetSdk\n\n// Load APK, keystore path from properties file.\nif (!debugStubPropFile.exists()) {\n    throw new GradleScriptException(\"Cannot find ${debugStubPropFile}\")\n} else {\n    def prop = new Properties()\n    debugStubPropFile.withInputStream { prop.load(it) }\n\n    def apkPath = prop.getProperty('apk', null)\n    if (apkPath) {\n        debugApk = rootProject.file(apkPath)\n        if (!debugApk.exists()) {\n            throw new GradleScriptException(\"Debugging APK not exist: ${debugApk}\")\n        }\n    } else throw new GradleScriptException(\"'apk' property not defined in ${debugStubPropFile}\")\n\n    def modules = prop.getProperty('modules', '').trim()\n    if (modules) {\n        debugModules.addAll modules.split(/\\s*,\\s*/)\n    }\n\n    def keystorePath = prop.getProperty('keystore', null)\n    keystoreFile = keystorePath ? rootProject.file(keystorePath) :\n            new File(\"${System.getProperty('user.home')}/.android/debug.keystore\")\n}\n\nif (Math.min(manifestFile.lastModified(), propFile.lastModified()) <\n        Math.max(debugApk.lastModified(), debugStubPropFile.lastModified())) {\n    // Find ABIs to be installed\n    def zf = new ZipFile(debugApk)\n    zf.entries().each {\n        def m = (it.name =~ /^lib\\/([\\w-]+)\\//)\n        if (m) installAbis << m.group(1)","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/Tencent/matrix/blob/3b8293bd65d47eeea7caf1f32a3a5d4d5eab60e7/matrix/matrix-android/gradle/WeChatDebugStub2.gradle#L24-L60","documentation":"Thrown from WeChatDebugStub2.gradle when debug-stub.properties exists but its 'apk' property is absent (or null). The debug-stub setup cannot proceed without knowing which APK to use, so the script throws GradleScriptException during configuration, telling the developer to define the 'apk' entry in the properties file.","triggerScenarios":"debugStubPropFile exists but contains no apk= line, or the key is misspelled/whitespace-mangled so getProperty('apk') returns null.","commonSituations":"Hand-editing the properties file and dropping the apk entry; template file with placeholders never filled in; using 'APK=' or wrong casing.","solutions":["Add the line apk=<path-to-debug-apk> to the properties file","Fix the key spelling to exactly 'apk'","Validate the properties file contents before running the debug stub task"],"exampleFix":"// before\n# modules=app   (no apk key)\n// after\napk=app/build/outputs/apk/debug/app-debug.apk\nmodules=app","handlingStrategy":"validation","validationCode":"def prop = new Properties(); prop.load(file('debug-stub.properties').newInputStream())\nassert prop.getProperty('apk') != null : 'apk key missing'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep a canonical template with apk= and modules= keys","Spell keys exactly as the script reads them","Lint properties files in CI"],"tags":["gradle","properties","missing-config","build-script"],"backgroundTag":"missing-required-config-field","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"}