android build_error ai_generated true

DexGuard: Mapping file not found: /path/to/mapping.txt. Obfuscation may fail.

ID: android/dexguard-obfuscation-mapping-not-found

Also available as: JSON · Markdown · 中文
80%Fix Rate
85%Confidence
1Evidence
2023-06-20First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
DexGuard 9.0 active
DexGuard 10.0 active
Android Gradle Plugin 7.4 active
Android Gradle Plugin 8.0 active

Root Cause

DexGuard requires a mapping file for incremental obfuscation, but the file is missing due to a clean build or misconfigured output path.

generic

中文

DexGuard 需要映射文件进行增量混淆,但由于清理构建或输出路径配置错误,该文件缺失。

Official Documentation

https://www.guardsquare.com/manual/dexguard/configuration

Workarounds

  1. 80% success Configure DexGuard to generate a new mapping file by adding '-dontobfuscate' temporarily, then re-enable obfuscation with the correct mapping path.
    Configure DexGuard to generate a new mapping file by adding '-dontobfuscate' temporarily, then re-enable obfuscation with the correct mapping path.
  2. 85% success Set the mapping file output path in the DexGuard configuration: '-printmapping /path/to/mapping.txt' and ensure the directory exists.
    Set the mapping file output path in the DexGuard configuration: '-printmapping /path/to/mapping.txt' and ensure the directory exists.
  3. 75% success Perform a clean build (./gradlew clean) and rebuild; DexGuard will create a new mapping file if the output directory is writable.
    Perform a clean build (./gradlew clean) and rebuild; DexGuard will create a new mapping file if the output directory is writable.

中文步骤

  1. 临时添加 '-dontobfuscate' 让 DexGuard 生成新映射文件,然后重新启用混淆并指定正确路径。
  2. 在 DexGuard 配置中设置映射文件输出路径:'-printmapping /path/to/mapping.txt' 并确保目录存在。
  3. 执行干净构建(./gradlew clean)并重新构建;如果输出目录可写,DexGuard 将创建新的映射文件。

Dead Ends

Common approaches that don't work:

  1. 80% fail

    DexGuard expects a mapping file for consistent obfuscation; without it, obfuscation may fail or produce inconsistent results.

  2. 90% fail

    This defeats the purpose of using DexGuard and may leave the app unprotected.