{"record":{"id":"77ed0618258a3ff8","repo":"shwenzhang/AndResGuard","slug":"the-old-mapping-file-do-not-exit-raw-path-s-configuration","errorCode":null,"errorMessage":"the old mapping file do not exit, raw path= %s\n","messagePattern":"the old mapping file do not exit, raw path= (.+?)\n","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"AndResGuard-core/src/main/java/com/tencent/mm/resourceproguard/Configuration.java","lineNumber":450,"sourceCode":"              mMergeDuplicatedRes = vaule.equals(\"true\");\n              System.out.println(\"mMergeDuplicatedRes \" + mMergeDuplicatedRes);\n              break;\n            case ATTR_SIGNFILE:\n              mMetaName = vaule.trim();\n              break;\n            default:\n              System.err.println(\"unknown tag \" + tagName);\n              break;\n          }\n        }\n      }\n    }\n  }\n\n  private void readOldMapping(String filePath) throws IOException {\n    mOldMappingFile = new File(filePath);\n    if (!mOldMappingFile.exists()) {\n      throw new IOException(String.format(\"the old mapping file do not exit, raw path= %s\\n\",\n          mOldMappingFile.getAbsolutePath()\n      ));\n    }\n    processOldMappingFile();\n    System.out.printf(\"you are using the keepmapping mode to proguard resouces: old mapping path:%s\\n\",\n        mOldMappingFile.getAbsolutePath()\n    );\n  }\n\n  private void processOldMappingFile() throws IOException {\n    mOldResMapping.clear();\n    mOldFileMapping.clear();\n\n    FileReader fr;\n    try {\n      fr = new FileReader(mOldMappingFile);\n    } catch (FileNotFoundException ex) {\n      throw new IOException(String.format(\"Could not find old mapping file %s\", mOldMappingFile.getAbsolutePath()));","sourceCodeStart":432,"sourceCodeEnd":468,"githubUrl":"https://github.com/shwenzhang/AndResGuard/blob/e4df245d82f27d9a2d0dd108260a3510cbaba849/AndResGuard-core/src/main/java/com/tencent/mm/resourceproguard/Configuration.java#L432-L468","documentation":"readOldMapping (invoked from the Configuration constructor when <keepmapping> is configured) converts the mapping path to a File and throws this IOException if mOldMappingFile.exists() is false. In keep-mapping mode AndResGuard reuses the resource names from a previous proguard mapping.txt, so that file must exist before processing begins.","triggerScenarios":"<keepmapping><path value=\"...\"/> points to a mapping.txt that does not exist on disk — wrong path, file not yet generated by proguard/R8, or path relative to a different working directory.","commonSituations":"Running resourceproguard before the proguard task produced mapping.txt in CI ordering issues; mapping.txt generated per-variant but config points at a fixed location; stale config after moving the module.","solutions":["Point <keepmapping><path value=\"...\"/> at the actual mapping.txt (typically app/build/outputs/mapping/<variant>/mapping.txt)","Ensure the proguard/R8 minify task runs and completes before the AndResGuard task in your build order","Use an absolute path or a path verified against the Gradle working directory"],"exampleFix":"// before (config.xml)\n<path value=\"mapping.txt\"/>\n// after (config.xml)\n<path value=\"/builds/app/build/outputs/mapping/release/mapping.txt\"/>","handlingStrategy":"validation","validationCode":"java.io.File mapping = new java.io.File(mappingPath);\nif (!mapping.exists()) {\n  throw new IllegalStateException(\"old mapping file missing: \" + mapping.getAbsolutePath() + \" — run proguard/R8 first\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  new Configuration(configFile, ...);\n} catch (IOException e) {\n  if (e.getMessage().startsWith(\"the old mapping file do not exit\")) {\n    // generate mapping.txt (minifyEnabled build) and update the keepmapping path\n  }\n  throw e;\n}","preventionTips":["Order the build so proguard/R8 (mapping generation) runs before AndResGuard","Use the variant-specific path build/outputs/mapping/<variant>/mapping.txt","Assert the mapping file exists at the start of your CI script"],"tags":["android","mapping","proguard","file-not-found"],"backgroundTag":"file-not-found","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"}