3

我想使用 ProGuard 来重命名变量和函数。我希望生成的类文件在除名称之外的所有方面都与源 jar 相同。有没有办法做到这一点?

我尝试使用dontoptimizedontshrink不起作用。

4

1 回答 1

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
于 2013-07-16T18:00:31.410 回答