shwenzhang/AndResGuard · error · brut.androlib.AndrolibException
res dest file is already found: destFile=
Error message
res dest file is already found: destFile=%s
What it means
After computing the destination file for an obfuscated resource, AndResGuard copies the raw file to the destination. If the destination already exists and mergeDuplicatedRes is disabled, two different source resources would collide at the same output path, so it throws to prevent silent overwrites. (A missing source file only logs a warning.)
Solutions
- Clean the output directory before rebuilding so leftover files from prior runs don't count as collisions.
- Enable mergeDuplicatedRes in the AndResGuard config to merge resources that resolve to the same destination instead of throwing.
- Disable or adjust mFixedResName if a fixed name forces multiple resources onto one path.
- Check the resguard naming config/whitelist for entries causing two resources to map to the same output path.
Example fix
// before
andResGuard {
fixedResName = "r" // all resources same name -> collisions
}
// after
andResGuard {
mergeDuplicatedRes = true
// fixedResName = null
} Defensive patterns
Strategy: fallback
Validate before calling
// clean output dir before build deleteRecursively(new File(project.buildDir, "AndResGuard"));
Try / catch
try {
ARSCDecoder.decode(arscStream, apkDecoder);
} catch (AndrolibException e) {
if (e.getMessage().contains("already found")) {
// enable mergeDuplicatedRes or clean the output directory and retry
}
} Prevention
- Clean the AndResGuard output directory between builds.
- Enable mergeDuplicatedRes for APKs known to contain duplicate resources.
- Avoid fixedResName configurations that collapse many resources onto one path.
When it happens
Trigger: During arsc decoding/repackaging, two distinct resource entries map to the same destination path (name collision after obfuscation, e.g. identical short names assigned to resources in different types merged into one directory) while config.mMergeDuplicatedRes is false and resDestFile.exists().
Common situations: APKs with duplicate resources across densities/types that collapse to the same obfuscated name; re-running output into a dirty output directory containing files from a previous run; custom fixedResName settings causing name collisions.
Understand the failure class
Background: "already exists" / EEXIST / FileAlreadyExistsException: what the 'file already exists' error means and how to fix it — this error's family across 37 libraries.
Related errors
- Failed to determine APK's minimum supported platform…
- can not found res dir in the apk or it is not a dir
- private key is not a DSA or RSA key
- Can't Generate signed APK. Plz check your v1sign info is…
- Can't Generate signed APK v2. Plz check your v2sign info is…
AI-assisted analysis of shwenzhang/AndResGuard@e4df245d82 (2026-09-12).
Data as JSON: /api/errors/28a0325df9ff7078.
Report an issue: GitHub.
Appendix: source
Thrown at AndResGuard-core/src/main/java/com/tencent/mm/androlib/res/decoder/ARSCDecoder.java:780
if (filterInfo != null) {
resDestFile = new File(filterInfo.filePath);
result = filterInfo.fileName;
}
}
//这里用的是linux的分隔符
HashMap<String, Integer> compressData = mApkDecoder.getCompressData();
if (compressData.containsKey(raw)) {
compressData.put(result, compressData.get(raw));
} else {
System.err.printf("can not find the compress dataresFile=%s\n", raw);
}
if (!resRawFile.exists()) {
System.err.printf("can not find res file, you delete it? path: resFile=%s\n", resRawFile.getAbsolutePath());
} else {
if (!mergeDuplicatedRes && resDestFile.exists()) {
throw new AndrolibException(String.format("res dest file is already found: destFile=%s",
resDestFile.getAbsolutePath()
));
}
if (filterInfo == null) {
FileOperation.copyFileUsingStream(resRawFile, resDestFile);
}
//already copied
mApkDecoder.removeCopiedResFile(resRawFile.toPath());
mTableStringsResguard.put(data, result);
}
}
}
}
/**
* resource filtering, filtering duplicate resources, reducing the volume of apk
*/
private MergeDuplicatedResInfo mergeDuplicated(File resRawFile, File resDestFile, String compatibaleraw, String result) throws IOException {View on GitHub (pinned to e4df245d82)