proguard只是混淆变量名?

时间:2013-01-01 04:03:39

标签: proguard

我想使用ProGuard重命名变量和函数。我希望生成的类文件在每个方面都与源jar相同,除了名称。有没有选择这样做?

我尝试使用dontoptimizedontshrink无效。

1 个答案:

答案 0 :(得分:3)

只需将以下内容放入.pro文件中,并确保不使用“-keep”选项以防止其他内容被混淆。

# Don't keep the local variables attributes (LocalVariableTable and LocalVariableTypeTable are dropped).
-keepattributes Exceptions,Signature,Deprecated,SourceFile,SourceDir,LineNumberTable,Synthetic,EnclosingMethod,RuntimeVisibleAnnotations,RuntimeInvisibleAnnotations,RuntimeVisibleParameterAnnotations,RuntimeInvisibleParameterAnnotations,AnnotationDefault,InnerClasses,*Annotation*

换句话说,请确保您的选项中没有以下内容

-keepattributes LocalVariableTable,LocalVariableTypeTable