How to Debug R8 Release-Only Android Crashes Without Disabling Optimization
Android developers often encounter crashes that appear only in release builds when R8 minification is enabled, while debug builds run without issues. These failures typically stem from runtime dependencies — such as reflection, JNI, or dynamic class loading — that static analysis tools like R8 cannot fully trace. Rather than disabling R8 or applying blanket keep rules, developers should first retrace obfuscated stack traces using R8's mapping.txt file to identify exactly which class or method is missing at runtime. The key question to ask after retracing is what runtime mechanism expected a particular class, method, or field to remain accessible — not just which class crashed. Inspecting the merged R8 configuration from build outputs, rather than only proguard-rules.pro, helps pinpoint whether a problematic rule originated from the app, Android tooling, or a third-party dependency.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.


Discussion (0)
Log in to join the discussion and vote.
Log in