【问题标题】:How to keep method arguments names from obfuscation by ProGuard如何防止方法参数名称被 ProGuard 混淆
【发布时间】:2021-05-11 14:27:12
【问题描述】:

对于给定的类:

class KeepMe(val keepThisArgument: Int) {
    fun keepMethod(keepThisArgument: Int) {
        println(keepThisArgument)
    }
}

和proguard配置:

-keep class com.KeepMe { *; }

以下代码由proguard生成:

public final class KeepMe {
  private final int keepThisArgument;
  
  public final void keepMethod(int paramInt) {
    System.out.println(paramInt);
  }
  
  public final int getKeepThisArgument() {
    return this.keepThisArgument;
  }
  
  public KeepMe(int paramInt) {
    this.keepThisArgument = paramInt;
  }
}

构造函数和方法参数名称从“keepThisArgument”更改为“paramInt”。有没有办法阻止它发生?我使用 net.sf.proguard gradle 插件,版本 6.2.2。

【问题讨论】:

    标签: kotlin proguard


    【解决方案1】:

    原来有单独的配置来保持所有类中的所有参数名称不会混淆:

    -keepparameternames
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-03-06
      • 2015-04-02
      • 2018-02-16
      • 2016-07-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多