0

I am trying to shrink my app size. From https://developer.android.com/studio/build/shrink-code, r8 is meant to remove unused code. In my experiment, r8 can clean my code, but doesn't remove unused dependencies completely.

This can be reproduced by adding unused dependencies and recheck output size. It's just growing. I record the steps here: https://github.com/tkkcc/r8confusion. I also tried enable android.enableR8.fullMode, output size is smaller but still growing.

bilabila
  • 973
  • 1
  • 12
  • 18
  • Most probably because those libraries include classes that are being kept either by default proguard rules or by library's consumer proguard rules. You can get a hint to which rules are keeping those classes - find a name of one of such classes from output apk and use `-whyareyoukeeping` proguard/r8 directive. – Alex Lipov Jan 18 '23 at 08:04

0 Answers0