0
0
Android Kotlinmobile~5 mins

ProGuard and R8 optimization in Android Kotlin - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is the main purpose of ProGuard in Android development?
ProGuard shrinks, optimizes, and obfuscates your app's code to reduce APK size and make reverse engineering harder.
Click to reveal answer
intermediate
How does R8 differ from ProGuard?
R8 combines shrinking, optimization, and obfuscation in one step and is the default code shrinker in Android Studio since version 3.4.
Click to reveal answer
beginner
What is a 'keep rule' in ProGuard or R8?
A keep rule tells the optimizer not to remove or rename certain classes or methods that are needed at runtime.
Click to reveal answer
beginner
Why is obfuscation important in Android apps?
Obfuscation renames classes and methods to unreadable names, making it harder for others to understand or copy your code.
Click to reveal answer
intermediate
When should you disable code shrinking in your Android app?
You might disable shrinking during debugging to speed up build times or if shrinking causes issues with reflection or libraries.
Click to reveal answer
Which tool is the default code shrinker in Android Studio since version 3.4?
AR8
BProGuard
CDexGuard
DLint
What does a 'keep rule' in ProGuard or R8 do?
APrevents removal or renaming of specified code
BCompresses images
CRemoves unused code
DGenerates logs
Which of the following is NOT a benefit of using ProGuard or R8?
AReducing APK size
BImproving app performance by optimizing code
CMaking reverse engineering harder
DAutomatically fixing runtime bugs
Why might you need to add keep rules when using R8?
ATo speed up compilation
BTo prevent removal of code used via reflection
CTo enable multi-threading
DTo increase APK size
What happens if you disable code shrinking in your Android app?
AObfuscation is improved
BApp runs faster
CApp size usually increases
DApp crashes immediately
Explain the roles of ProGuard and R8 in Android app optimization.
Think about how these tools help reduce app size and protect code.
You got /4 concepts.
    Describe why and when you would use keep rules in your Android project.
    Consider cases where code is used indirectly and must not be removed.
    You got /4 concepts.