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

 偶然公大伟 发布于 2023-02-13 13:21

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

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

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.** {
    ;
    ;
}

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

Eric Lafortu.. 7

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

-keepattributes LocalVariableTable,LocalVariableTypeTable

你至少可以排除那些

-keepattributes !LocalVariableTable,!LocalVariableTypeTable

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

请参阅ProGuard手册> Usage> -keepattributes

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

    -keepattributes LocalVariableTable,LocalVariableTypeTable
    

    你至少可以排除那些

    -keepattributes !LocalVariableTable,!LocalVariableTypeTable
    

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

    请参阅ProGuard手册> Usage> -keepattributes

    2023-02-13 13:22 回答
撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有