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?
✗ Incorrect
R8 replaced ProGuard as the default shrinker and optimizer in Android Studio 3.4 and later.
What does a 'keep rule' in ProGuard or R8 do?
✗ Incorrect
Keep rules protect code from being removed or renamed during shrinking and obfuscation.
Which of the following is NOT a benefit of using ProGuard or R8?
✗ Incorrect
ProGuard and R8 do not fix runtime bugs automatically; they focus on shrinking, optimizing, and obfuscating code.
Why might you need to add keep rules when using R8?
✗ Incorrect
Code accessed by reflection might be removed if not kept explicitly with keep rules.
What happens if you disable code shrinking in your Android app?
✗ Incorrect
Disabling shrinking keeps all code, which usually increases the app size.
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.