我们可以缩小所有类,而仅使proguard混淆一些类吗? [英] Can we shrink all classes but only obfuscate some with proguard?
问题描述
通常,使用-keep排除类可防止混淆该类
Typically, excluding a class with -keep prevents the class from being obfuscated
但是,它也可以防止其缩小.
However it also prevents it from being shrunk.
是否可以定义一个proguard-project.txt文件,该文件将收缩所有类(除了那些被-keep排除的类以外),而且还仅模糊了这些类的特定子集?
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?
目标是使用proguard保持低于android 65k方法的限制,同时也仅在APK中混淆第一方代码.
The aim is to use proguard to keep below the android 65k method limit, while also obfuscating first party code ONLY within the APK.
谢谢
推荐答案
是的,您可以将修饰符allowshrinking
添加到-keep
选项,该选项仅适用于混淆(和优化)步骤.例如:
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.
这篇关于我们可以缩小所有类,而仅使proguard混淆一些类吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!