我似乎找不到混淆局部变量的设置,在一个被混淆的类的方法内。
这是我反编译的一个类的摘录,其中有一些明显缺失的部分。理想情况下,方法和局部变量的参数也会被混淆。
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;
boolean wavesRemain = game.r() > 0;
return (playerDead) || ((!wavesRemain) && (enemyDead));
}
public eA(gt gameState, gt boardState)
{
this.b = gameState;
this.a = boardState;
}
public void a()
{
n();
boolean playerDead = this.f.k().j() <= 0;
boolean enemyDead = this.f.g().a().size <= 0;
if (a(this.f)) {
if (enemyDead) {
this.f.a(new eG(1));
this.e.a(new eW());
} else if (playerDead) {
this.f.a(new eF());
编辑,我还附上了proguard配置
-dontskipnonpubliclibraryclassmembers
-dontshrink
-dontoptimize
-printmapping build/libs/output/obfuscation.map
-keepattributes
-adaptclassstrings
-dontnote
-dontwarn
# Keep Android classes
-keep class ** extends android.** {
<fields>;
<methods>;
}
# Keep serializable classes & fields
-keep class ** extends java.io.Serializable {
<fields>;
}
# 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 <methods>;
}
答案 0 :(得分:7)
您应该删除或优化选项-keepattributes
。它意味着使用局部变量名保存属性:
-keepattributes LocalVariableTable,LocalVariableTypeTable
你至少可以排除那些
-keepattributes !LocalVariableTable,!LocalVariableTypeTable
理想情况下,您只保留严格要求的属性。
请参阅ProGuard手册&gt;用法&gt; -keepattributes