android
build_error
ai_generated
true
DexGuard:混淆失败:无法读取映射文件:/path/to/mapping.txt
DexGuard: Obfuscation failed: Unable to read mapping file: /path/to/mapping.txt
ID: android/dexguard-obfuscation-missing-mapping
82%修复率
86%置信度
1证据数
2024-01-05首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| DexGuard 9.3.0 | active | — | — | — |
| DexGuard 10.0.0 | active | — | — | — |
| AGP 8.2.0 | active | — | — | — |
| Gradle 8.5 | active | — | — | — |
根因分析
DexGuard 期望之前的 mapping.txt 文件用于增量混淆,但文件缺失或路径不正确。
English
DexGuard expects a previous mapping.txt file for incremental obfuscation, but the file is missing or path is incorrect.
官方文档
https://www.guardsquare.com/manual/dexguard/tools/retrace解决方案
-
Add `-applymapping /path/to/valid/mapping.txt` in DexGuard config with the correct path from a previous successful build, or remove the line if incremental obfuscation is not needed.
-
Run a full clean build: `./gradlew clean assembleRelease` without incremental mapping to generate a new mapping.txt file.
无效尝试
常见但无效的做法:
-
50% 失败
Setting `-dontobfuscate` in DexGuard config disables obfuscation entirely, which defeats the purpose of using DexGuard for security.
-
90% 失败
Copying a mapping.txt from a different build variant or version may cause class name conflicts and runtime crashes.
-
70% 失败
Clearing the entire build cache with `./gradlew clean` deletes all intermediate files, including mapping.txt, worsening the issue.