设置ProGuard以模糊局部变量和参数

我似乎找不到混淆局部变量的设置,在一个被混淆的类的方法内部。

这是我反编译的一个类的摘录,其中有一些明显缺失的部分。 理想情况下,方法和局部变量的参数也会被混淆。

public class eA extends gu { private final gt a; private final gt b; public static boolean a(fy game) { boolean playerDead = game.k().j() <= 0; boolean enemyDead = game.g().a().size  0; return (playerDead) || ((!wavesRemain) && (enemyDead)); } public eA(gt gameState, gt boardState) { this.b = gameState; this.a = boardState; } public void a() { n(); boolean playerDead = this.fk().j() <= 0; boolean enemyDead = this.fg().a().size <= 0; if (a(this.f)) { if (enemyDead) { this.fa(new eG(1)); this.ea(new eW()); } else if (playerDead) { this.fa(new eF()); 

编辑,我也附上了proguard配置

 -dontskipnonpubliclibraryclassmembers -dontshrink -dontoptimize -printmapping build/libs/output/obfuscation.map -keepattributes -adaptclassstrings -dontnote -dontwarn # Keep Android classes -keep class ** extends android.** { ; ; } # Keep serializable classes & fields -keep class ** extends java.io.Serializable { ; } # Keep - Applications. Keep all application classes, along with their 'main' # methods. -keepclasseswithmembers public class * { public static void main(java.lang.String[]); } # Also keep - Enumerations. Keep the special static methods that are required in # enumeration classes. -keepclassmembers enum * { public static **[] values(); public static ** valueOf(java.lang.String); } # Keep names - Native method names. Keep all native class/method names. -keepclasseswithmembers,allowshrinking class * { native ; } 

您应该删除或优化选项-keepattributes 。 它意味着保持属性与局部变量名称:

 -keepattributes LocalVariableTable,LocalVariableTypeTable 

你至少可以排除那些

 -keepattributes !LocalVariableTable,!LocalVariableTypeTable 

理想情况下,您只保留严格要求的属性。

请参阅ProGuard手册> Usage> -keepattributes