Log date · Mon
How do you verify ProGuard mapping after an upgrade?
Retrace a test crash with its build’s mapping and verify methods and lines. An R8 comparison shows how inlining changes a stack.
How do you verify a ProGuard mapping after an upgrade?
After upgrading, retrace a deliberately triggered exception with the mapping from that exact build, then check the methods and line numbers. In our R8 comparison, the optimized build reduced three source frames to one runtime frame; retracing restored three. The build without optimization produced three runtime frames, and both retraced to the same locations.
| Question | Result |
|---|---|
| Optimized stack | 1 runtime frame, retraced to 3 source frames |
| Optimization disabled | 3 runtime frames, retraced to the same 3 frames |
| Was ProGuard 7.10 tested? | No; this is an R8 illustration |
On 2026-08-24 at 13:48 UTC, Guardsquare released ProGuard 7.10 (tag v7.10.0), adding Kotlin 2.4 and Java 27 support and fixing a broken mapping when method inlining was applied, issue #520. [1] This compatibility and correctness release makes a successful build an insufficient check of the diagnostic pipeline.
The experiment: two optimization settings
We compiled our own sample to Java 8 classfiles with Java 17.0.19, then generated classfiles with R8 8.3.37. One build used optimization; the other added -dontoptimize. Both kept the entry point and line numbers. This illustrates the relationship between inlining and mappings with another tool; it is not a test of ProGuard 7.10, Kotlin 2.4, Java 27 or Android DEX.
public class Checkout {
public void submit() { validate(); }
private void validate() { throw new IllegalStateException("DEMO failure"); }
}The optimized build inlined both Checkout methods into Main.main. Its mapping associates the same output line with validate, submit and main, while the runtime trace shows only Main.main. R8 retrace uses the mapping to reconstruct that call chain. [4] The complete optimized exception and retraced output follow.
Exception in thread "main" java.lang.IllegalStateException: DEMO failure
at demo.Main.main(SourceFile:1)
== optimized retraced ==
Exception in thread "main" java.lang.IllegalStateException: DEMO failure
at demo.Checkout.validate(Checkout.java:4)
at demo.Checkout.submit(Checkout.java:3)
at demo.Main.main(Main.java:4)What changes when optimization is disabled?
Without optimization, Checkout became a.a, and validate and submit became b and a. The exception already had three frames, but the mapping was still needed to associate them with the original methods. Both results retraced to lines 4 and 3 of Checkout.java and line 4 of Main.java. This verifies one known exception path in the sample, not every path.
Exception in thread "main" java.lang.IllegalStateException: DEMO failure
at a.a.b(SourceFile:1)
at a.a.a(SourceFile:4)
at demo.Main.main(SourceFile:1)A mapping file merely existing is not enough. The report for issue #520 describes conditions in which retracing produced large stacks that did not represent the actual call chain; a file can exist and still yield an incorrect result. [2] The ProGuard ReTrace manual explains that the mapping restores original names. [3] Compare the output to known source locations to establish whether the result is useful.
Recommendations for an upgrade
The table gives engineering recommendations. Retain the tool version, configuration and mapping associated with each release artifact so a later diagnosis can be reproduced. A mapping connects original and obfuscated names, so restrict access and retain it under your team’s policy.
| Case | Recommendation |
|---|---|
| Upgrading Kotlin or Java | Check the ProGuard version and complete build chain, then run a release build. |
| Optimization or inlining enabled | Use a test exception with a known call chain and check methods, order and lines. |
| Mapping missing or retrace unexpected | Check build identity and the matching file; investigate before permanently disabling renaming. |
| Dynamic calls depend on names | Identify the actual contract, review keep rules and test critical paths. |
Keep rules should reflect real reflection and dynamic-call requirements. Broad rules may retain code that could otherwise be renamed or removed. Compare outputs such as seeds and usage after the upgrade, and interpret differences alongside functional tests. Renaming reduces readable clues; it does not encrypt logic or replace server-side authorization.
Verify your own build
We built a small sample with optimization enabled and disabled, captured the exception traces, and ran R8 retrace on both results.
java -cp path/to/r8.jar com.android.tools.r8.retrace.Retrace path/to/mapping.txt path/to/stacktrace.txtNext, build with your actual release configuration in a test environment and trigger an exception with a known call chain. Give the original trace, exact build identifier and matching mapping to the appropriate retrace tool. Check class, method, line and call order. Android documents how R8 retrace accepts a mapping and stack trace file. [4] For a ProGuard project, use the corresponding tool as described in its ReTrace manual. [3]
retrace path/to/mapping.txt path/to/stacktrace.txtInclude this check in upgrade acceptance. Alongside the sample exception, run release tests covering reflection, serialization and critical application flows. If the result is wrong, first confirm that the files belong to the same build, then examine tool versions, optimization settings and a reproducible input. Retain the original trace as well as the retraced result.
Your checklist
- Check ProGuard, Kotlin and Java versions and the build chain.
- Trigger a test exception with a known call chain in the release configuration.
- Retrace using the matching mapping and verify methods, order and lines.
- Restrict mapping access and associate it with the exact build.
- Compare retained and removed code across the upgrade and test dynamic calls.
Primary sources
- GitHub: Guardsquare/proguard release 7.10 · Source date 2026-08-24 · Checked 2026-10-12
- GitHub: ProGuard issue #520 · Checked 2026-11-11
- ProGuard manual: ReTrace · Checked 2026-11-11
- Android Developers: R8 retrace · Checked 2026-11-11