{"record":{"id":"26e26ca8d73efc4f","repo":"shwenzhang/AndResGuard","slug":"please-write-the-full-package-name-eg-com-tencent-mm-r","errorCode":null,"errorMessage":"please write the full package name,eg com.tencent.mm.R.drawable.dfdf, but yours %s\n","messagePattern":"please write the full package name,eg com\\.tencent\\.mm\\.R\\.drawable\\.dfdf, but yours (.+?)\n","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"AndResGuard-core/src/main/java/com/tencent/mm/resourceproguard/Configuration.java","lineNumber":270,"sourceCode":"        Node child = childNodes.item(j);\n        if (child.getNodeType() == Node.ELEMENT_NODE) {\n          Element check = (Element) child;\n          String vaule = check.getAttribute(ATTR_VALUE);\n          addWhiteList(vaule);\n        }\n      }\n    }\n  }\n\n  private void addWhiteList(String item) throws IOException {\n    if (item.length() == 0) {\n      throw new IOException(\"Invalid config file: Missing required attribute \" + ATTR_VALUE);\n    }\n\n    int packagePos = item.indexOf(\".R.\");\n    if (packagePos == -1) {\n\n      throw new IOException(String.format(\"please write the full package name,eg com.tencent.mm.R.drawable.dfdf, but yours %s\\n\",\n          item\n      ));\n    }\n    //先去掉空格\n    item = item.trim();\n    String packageName = item.substring(0, packagePos);\n    //不能通过lastDot\n    int nextDot = item.indexOf(\".\", packagePos + 3);\n    String typeName = item.substring(packagePos + 3, nextDot);\n    String name = item.substring(nextDot + 1);\n    HashMap<String, HashSet<Pattern>> typeMap;\n\n    if (mWhiteList.containsKey(packageName)) {\n      typeMap = mWhiteList.get(packageName);\n    } else {\n      typeMap = new HashMap<>();\n    }\n","sourceCodeStart":252,"sourceCodeEnd":288,"githubUrl":"https://github.com/shwenzhang/AndResGuard/blob/e4df245d82f27d9a2d0dd108260a3510cbaba849/AndResGuard-core/src/main/java/com/tencent/mm/resourceproguard/Configuration.java#L252-L288","documentation":"addWhiteList throws this IOException when a whitelist entry has no \".R.\" marker, meaning it is not written as a fully qualified resource name like com.example.app.R.drawable.icon. The parser uses indexOf(\".R.\") to split the package name from the resource type and name; without it the entry cannot be decomposed into the package/type/name triple the whitelist map requires.","triggerScenarios":"A <item value=\"...\"/> under <whitelist> contains a resource path with only slashes (res/drawable/icon), a bare resource name (icon), or a package name typo that omits the .R. segment; addWhiteList computes item.indexOf(\".R.\") == -1 and throws.","commonSituations":"Users copying AAPT resource file paths (res/drawable-hdpi/foo.png) instead of the fully qualified Java resource names into the whitelist; mixing Gradle resourceproguardOptions whitelist syntax (which accepts different forms) with the old XML config syntax.","solutions":["Rewrite the whitelist entry as the full qualified name: <package>.R.<type>.<name>, e.g. com.example.app.R.drawable.icon","Check the value for typos in the package name — the literal substring .R. must be present","If you intended to keep a whole resource file path, use the correct format for your AndResGuard version (newer versions accept file paths in whitelist via different tooling)"],"exampleFix":"// before (config.xml)\n<item value=\"res/drawable/ic_launcher\"/>\n// after (config.xml)\n<item value=\"com.example.app.R.drawable.ic_launcher\"/>","handlingStrategy":"validation","validationCode":"String v = itemElement.getAttribute(\"value\");\nif (v.indexOf(\".R.\") == -1) {\n  throw new IllegalStateException(\"whitelist entry must be fully qualified like com.example.app.R.drawable.icon, got: \" + v);\n}","typeGuard":null,"tryCatchPattern":"try {\n  new Configuration(configFile, ...);\n} catch (IOException e) {\n  if (e.getMessage().startsWith(\"please write the full package name\")) {\n    // extract the offending item from the message and rewrite it as <pkg>.R.<type>.<name>\n  }\n  throw e;\n}","preventionTips":["Always use Java-style qualified resource names (com.pkg.R.type.name) in whitelist XML, not res/ file paths","Grep your config for values containing 'res/' to catch path-style entries early","Copy the exact resource name from R.java / lint output rather than typing it"],"tags":["android","config","xml","whitelist","format"],"backgroundTag":"invalid-argument-format","analyzedSha":"e4df245d82f27d9a2d0dd108260a3510cbaba849","analyzedAt":"2026-09-12T17:49:07.798Z","contentChangedAt":"2026-09-12T17:49:07.798Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}