Hint: Both flags together shrink code and resources [OK]
Common Mistakes:
Thinking it adds debugging info
Assuming no effect on size
Confusing syntax causing build failure
4. You enabled minifyEnabled true and shrinkResources true but your app crashes on startup. What is the most likely cause?
medium
A. You forgot to add ProGuard rules to keep necessary classes
B. You did not enable debugging mode
C. You used wrong syntax in build.gradle
D. You did not update your Android Studio version
Solution
Step 1: Understand minify effect on code
Minify removes unused code but can mistakenly remove needed classes if rules are missing.
Step 2: Importance of ProGuard rules
Proper rules keep essential classes from removal, preventing crashes.
Final Answer:
You forgot to add ProGuard rules to keep necessary classes -> Option A
Quick Check:
Missing ProGuard rules cause crashes after minify [OK]
Hint: Always add ProGuard rules when minifying [OK]
Common Mistakes:
Blaming debugging mode
Assuming syntax error without checking logs
Ignoring ProGuard configuration
5. You want to reduce your Android app size by removing unused resources but keep some images used only in code via reflection. How should you configure your build to avoid removing these images?
hard
A. Add keep rules in proguard-rules.pro to keep resource references
B. Disable shrinkResources and rely only on minifyEnabled
C. Rename the images to start with underscore to protect them
D. Use shrinkResources with resConfigs to specify languages only
Solution
Step 1: Understand resource shrinking behavior
Resource shrinking removes unused resources detected by static analysis.
Step 2: Handling resources used via reflection
Resources accessed dynamically may appear unused and get removed unless explicitly kept.
Step 3: Use ProGuard keep rules
Adding keep rules in proguard-rules.pro tells the shrinker to keep these resources.
Final Answer:
Add keep rules in proguard-rules.pro to keep resource references -> Option A
Quick Check:
Keep rules protect resources used dynamically [OK]
Hint: Use keep rules to protect resources used by reflection [OK]
Common Mistakes:
Disabling shrinkResources loses size benefits
Renaming files does not protect them
Using resConfigs only filters languages, not resources
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.