设置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;

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>;

}

回答:

您应该删除或优化该选项-keepattributes。这意味着使用局部变量名称保留属性:

-keepattributes LocalVariableTable,LocalVariableTypeTable

您至少可以排除那些

-keepattributes !LocalVariableTable,!LocalVariableTypeTable

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

请参阅ProGuard手册>用法>

-keepattributes

以上是 设置ProGuard以混淆局部变量和参数 的全部内容, 来源链接: utcz.com/qa/428223.html

回到顶部