Can we shrink all classes, but only obfuscate some with proguard?… here is a solution to the problem.
Can we shrink all classes, but only obfuscate some with proguard?
In general, excluding classes with -keep prevents classes from being confused
But it also prevents it from being scaled down.
Is it possible to define a proguard-project.txt to narrow down all classes except those excluded with -keep, but also obfuscate only a specific subset of classes?
The goal is to use a shuffler to stay below the android 65k method limit while also obfuscating only first-party code in APKs.
Thanks
Solution
Yes, you can add the modifier allowshrinking
to the -keep
option that should only be applied to obfuscation (and optimization) steps. For example:
-keep,allowshrinking class com.example.SomeClass
If the specified class is not used in the minification step, it may be deleted, otherwise, its name will be preserved in the obfuscation step.