android build_error ai_generated true

DexGuard: Obfuscation failed: Unable to read mapping file: /path/to/mapping.txt

ID: android/dexguard-obfuscation-missing-mapping

Also available as: JSON · Markdown · 中文
82%Fix Rate
86%Confidence
1Evidence
2024-01-05First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
DexGuard 9.3.0 active
DexGuard 10.0.0 active
AGP 8.2.0 active
Gradle 8.5 active

Root Cause

DexGuard expects a previous mapping.txt file for incremental obfuscation, but the file is missing or path is incorrect.

generic

中文

DexGuard 期望之前的 mapping.txt 文件用于增量混淆,但文件缺失或路径不正确。

Official Documentation

https://www.guardsquare.com/manual/dexguard/tools/retrace

Workarounds

  1. 85% success 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.
    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.
  2. 90% success Run a full clean build: `./gradlew clean assembleRelease` without incremental mapping to generate a new mapping.txt file.
    Run a full clean build: `./gradlew clean assembleRelease` without incremental mapping to generate a new mapping.txt file.

中文步骤

  1. 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.
  2. Run a full clean build: `./gradlew clean assembleRelease` without incremental mapping to generate a new mapping.txt file.

Dead Ends

Common approaches that don't work:

  1. 50% fail

    Setting `-dontobfuscate` in DexGuard config disables obfuscation entirely, which defeats the purpose of using DexGuard for security.

  2. 90% fail

    Copying a mapping.txt from a different build variant or version may cause class name conflicts and runtime crashes.

  3. 70% fail

    Clearing the entire build cache with `./gradlew clean` deletes all intermediate files, including mapping.txt, worsening the issue.