{"record":{"id":"086fc02e76adb0cc","repo":"shwenzhang/AndResGuard","slug":"can-not-find-or-raw-string-in-res-path-s","errorCode":null,"errorMessage":"can not find \\ or raw string in res path = %s","messagePattern":"can not find \\\\ or raw string in res path = (.+?)","errorType":"exception","errorClass":"brut.androlib.AndrolibException","httpStatus":null,"severity":"error","filePath":"AndResGuard-core/src/main/java/com/tencent/mm/androlib/res/decoder/ARSCDecoder.java","lineNumber":728,"sourceCode":"    mIn.skipCheckByte((byte) 0);\n    byte type = mIn.readByte();\n    int data = mIn.readInt();\n\n    //这里面有几个限制，一对于string ,id, array我们是知道肯定不用改的，第二看要那个type是否对应有文件路径\n    if (mPkg.isCanResguard()\n       && flags\n       && type == TypedValue.TYPE_STRING\n       && mShouldResguardForType\n       && mShouldResguardTypeSet.contains(mType.getName())) {\n      if (mTableStringsResguard.get(data) == null) {\n        String raw = mTableStrings.get(data).toString();\n        if (StringUtil.isBlank(raw) || raw.equalsIgnoreCase(\"null\")) return;\n\n        String proguard = mPkg.getSpecRepplace(mResId);\n        //这个要写死这个，因为resources.arsc里面就是用这个\n        int secondSlash = raw.lastIndexOf(\"/\");\n        if (secondSlash == -1) {\n          throw new AndrolibException(String.format(\"can not find \\\\ or raw string in res path = %s\", raw));\n        }\n\n        String newFilePath = raw.substring(0, secondSlash);\n\n        if (!mApkDecoder.getConfig().mKeepRoot) {\n          newFilePath = mOldFileName.get(raw.substring(0, secondSlash));\n        }\n        if (newFilePath == null) {\n          System.err.printf(\"can not found new res path, raw=%s\\n\", raw);\n          return;\n        }\n        //同理这里不能用File.separator，因为resources.arsc里面就是用这个\n        String result = newFilePath + \"/\" + proguard;\n        int firstDot = raw.indexOf(\".\");\n        if (firstDot != -1) {\n          result += raw.substring(firstDot);\n        }\n        String compatibaleraw = new String(raw);","sourceCodeStart":710,"sourceCodeEnd":746,"githubUrl":"https://github.com/shwenzhang/AndResGuard/blob/e4df245d82f27d9a2d0dd108260a3510cbaba849/AndResGuard-core/src/main/java/com/tencent/mm/androlib/res/decoder/ARSCDecoder.java#L710-L746","documentation":"When rewriting file path strings inside resources.arsc, AndResGuard expects each raw resource path to contain a '/' separating the res directory from the file name. If lastIndexOf(\"/\") finds no separator, it cannot split the path into directory and file components and throws this AndrolibException.","triggerScenarios":"A resource entry's raw string value (file path in arsc, e.g. \"res/drawable/icon.png\") has no slash — occurring when the arsc contains rewritten/malformed path strings, entries from a previous obfuscation without keepRoot, or resource paths not rooted under res/.","commonSituations":"Double-processing an APK already obfuscated by AndResGuard or another tool (paths already renamed); arsc entries pointing at assets-style paths without slashes; tampered/packed APKs with modified string pools.","solutions":["Run AndResGuard on the original unobfuscated APK, not one already processed by another resource tool.","Inspect resources.arsc string pool (aapt dump resources) to find the offending path and rebuild the APK from sources.","Enable config.mKeepRoot consistently across runs so path expectations match.","Upgrade AndResGuard — handling of non-res-rooted and already-renamed paths improved over releases."],"exampleFix":"// before\napply AndResGuard to app-release-resguard.apk // already obfuscated\n// after\napply AndResGuard to the original app-release.apk from assembleRelease","handlingStrategy":"validation","validationCode":"// before running obfuscation, sanity-check raw paths in arsc\nif (!rawResPath.contains(\"/\")) {\n    throw new IllegalStateException(\"resource path not res-rooted: \" + rawResPath);\n}","typeGuard":null,"tryCatchPattern":"try {\n    ARSCDecoder.decode(arscStream, apkDecoder);\n} catch (AndrolibException e) {\n    if (e.getMessage().contains(\"can not find\")) {\n        // input APK likely already obfuscated or tampered; use original APK\n    }\n}","preventionTips":["Only run AndResGuard once per APK, on the original artifact.","Keep mKeepRoot setting consistent between runs.","Verify input APKs with aapt dump before processing."],"tags":["arsc","resource-path","obfuscation"],"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"}