ProGuard
ProGuard is a tool for shrinking, optimizing, obfuscating, and stripping unused code in Java and Android applications. It helps reduce APK/AAB size, protect source code from reverse engineering, and improve performance.
🔹 Key Features of ProGuard
Shrinking: Removes unused classes, methods, and fields.
Optimization: Optimizes bytecode for better performance and reduced size.
Obfuscation: Renames classes, methods, and variables to meaningless short names, making it harder to reverse-engineer.
Stripping: Removes unnecessary libraries and code to minimize the application size.
🔹 ProGuard in Android
Built into the Android SDK but has been largely replaced by R8 since Android Studio 3.4 (R8 is faster and more efficient).
Activated in release mode by enabling
minifyEnabled
inbuild.gradle
:
🔹 Things to Watch Out for
May accidentally remove necessary code (especially with reflection, Gson, Retrofit).
Requires a proguard-rules.pro file to keep essential components, for example:
Last updated