Skip to content
Commitwise
Menu

R8

Also called: ProGuard

The Android build tool that shrinks, obfuscates and optimizes release builds.

Definition

R8 removes classes and methods nothing calls, renames what remains to short names, and optimizes the code. It can't see code accessed only by name at runtime through reflection, such as fields filled in by Gson, so those need keep rules or annotations, or a code-generated library instead. The mapping file it produces is needed to turn obfuscated crash stack traces back into real names.

In practice

With isMinifyEnabled = true, an OrderDto parsed by Gson loses its field names unless they are kept.

Related terms

Esc

Type to search the whole site.