Typically, excluding a class with -keep prevents the class from being obfuscated
However it also prevents it from being shrunk.
Is it possible to define a proguard-project.txt that will shrink all classes except those that are excluded with -keep, but also obfuscate only a specific subset of the classes?
The aim is to use proguard to keep below the android 65k method limit, while also obfuscating first party code ONLY within the APK.
Thanks
Yes, you can add the modifier allowshrinking
to the -keep
options that should only apply to the obfuscation (and optimization) steps. For instance:
-keep,allowshrinking class com.example.SomeClass
The specified class may be removed if it appears unused in the shrinking step, but otherwise, its name will be preserved in the obfuscation step.