shwenzhang/AndResGuard · error
the old mapping file do not exit, raw path=
Error message
the old mapping file do not exit, raw path= %s
What it means
Configuration.setKeepMappingData throws IOException('the old mapping file do not exit, raw path= %s') when keep-mapping is enabled (mUseKeepMapping=true) but the old proguard/R8 mapping File does not exist. The mapping is needed to reuse previous resource-name mappings so obfuscated names stay stable across releases.
Solutions
- Check mappingFile.exists() before enabling keep-mapping, and skip/disable keep-mapping when no prior mapping exists (normal for the first release).
- Point the config at the correct previous build's mapping.txt (pin/copy it to a stable location like version control or an artifacts store).
- Use an absolute, stable path for the mapping file rather than a clean-prone build/ subpath.
Example fix
// before
config.setUseKeepMapping(true);
config.setKeepMappingData(new File("build/outputs/mapping/release/mapping.txt"));
// after
File mapping = new File(project.getRootDir(), "resguard-mapping/mapping.txt");
if (mapping.isFile()) {
config.setUseKeepMapping(true);
config.setKeepMappingData(mapping);
} // first build: keep-mapping off, mapping generated fresh Defensive patterns
Strategy: validation
Validate before calling
File m = new File(mappingPath); if (!m.isFile()) { /* disable keep-mapping or fail with clear message */ } Try / catch
try { config.setKeepMappingData(mappingFile); } catch (IOException e) { logger.warn("keep-mapping disabled: no prior mapping"); config.setUseKeepMapping(false); } Prevention
- Archive mapping.txt to a stable location after each release build
- Skip keep-mapping on the first build when no mapping exists yet
- Keep mapping outside clean-prone build/ directories
When it happens
Trigger: Enabling resguard keep-mapping via config (setKeepMappingData called from the Configuration constructor) with a mapping.txt path that does not exist on disk.
Common situations: First build with keep-mapping enabled but no previous mapping.txt produced yet; mapping.txt cleaned by gradle clean or archived away; wrong variant's mapping path configured.
Understand the failure class
Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.
Related errors
- the old mapping file do not exit, raw path=
- the signature file do not exit, raw path=
- the old mapping file packagename is malformed, it should be…
- can not found the raw apk file to zipalign, path=
- the old mapping res file path should be like r/a, yours
AI-assisted analysis of shwenzhang/AndResGuard@e4df245d82 (2026-09-12).
Data as JSON: /api/errors/a541a77cd45ddec3.
Report an issue: GitHub.
Appendix: source
Thrown at AndResGuard-core/src/main/java/com/tencent/mm/resourceproguard/Configuration.java:168
File signatureFile, String keypass, String storealias, String storepass) throws IOException {
mUseSignAPK = true;
mSignatureFile = signatureFile;
if (!mSignatureFile.exists()) {
throw new IOException(String.format("the signature file do not exit, raw path= %s\n",
mSignatureFile.getAbsolutePath()
));
}
mKeyPass = keypass;
mStoreAlias = storealias;
mStorePass = storepass;
}
private void setKeepMappingData(File mappingFile) throws IOException {
if (mUseKeepMapping) {
mOldMappingFile = mappingFile;
if (!mOldMappingFile.exists()) {
throw new IOException(String.format("the old mapping file do not exit, raw path= %s",
mOldMappingFile.getAbsolutePath()
));
}
processOldMappingFile();
}
}
private void readXmlConfig(File xmlConfigFile) throws IOException, ParserConfigurationException, SAXException {
if (!xmlConfigFile.exists()) {
return;
}
System.out.printf("reading config file, %s\n", xmlConfigFile.getAbsolutePath());
BufferedInputStream input = null;
try {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
input = new BufferedInputStream(new FileInputStream(xmlConfigFile));
InputSource source = new InputSource(input);View on GitHub (pinned to e4df245d82)