What is ProGuard?

Perhaps you noticed the file proguard-rules.pro in your app directory?

Why do we need that?


ProGuard has three use cases:

  • shrinking
  • obfuscating
  • optimizing

Code shrinking

Often called “tree shaking”, shrinking optimizes the byte code by removing unused code.

Resource shrinking

After code shrinking all non-referenced resources will be removed as well


This step shortens names of classes and members to further reduce code size.


further reduces size by removing unused code like never executed else statements


In Android Studio 3.3 Google introduced the new R8 tool which shall replace ProGuard

Since Android Studio 3.4 R8 is enabled by default.

R8 ist stil configured via the proguard-rules.pro file