【发布时间】:2021-05-24 23:36:42
【问题描述】:
当使用 Proguard 时,一些方法体被替换为:
public void someMethod(int paramInt1, int paramInt2, boolean paramBoolean, String paramString){
// Byte code:
// 0: aload_1
// 1: invokeinterface getItemId : ()I
// 6: istore_2
// 7: iload_2
// 8: ldc_w 2131296320
// 11: if_icmpne -> 31
// 14: aload_0
// 15: new android/content/Intent
// 18: dup
// 19: aload_0
// 20: ldc_w com/example/turtle/Activity
// 23: invokespecial <init> : (Landroid/content/Context;Ljava/lang/Class;)V
// 26: invokevirtual startActivity : (Landroid/content/Intent;)V
// 29: iconst_1
// 30: ireturn
// 31: iload_2
// 32: ldc_w 2131296310
// 35: if_icmpne -> 95
// 38: aload_0
// 39: getfield O : Landroid/view/View;
// 42: ldc_w 'Layout Changed'
// ...
}
虽然他们中的大多数都有这样的东西:
public void anotherMethod(){
this.W.setColor(i);
this.X.setTextColor(i);
this.Y.setColor(i);
this.Z.setColor(i);
b.c.a.x0.a a1 = new b.c.a.x0.a();
a1.setDuration(100);
a.u.m.a((ViewGroup)this.a0, (a.u.i)a1);
if (this.U) {
this.a0.removeView((View)this.h0);
linearLayout = this.a0;
a2 = this.g0;
} else {
this.a0.removeView((View)this.b0);
this.a0.removeView((View)this.d0);
linearLayout = this.a0;
a2 = this.e0;
}
}
为什么它们都不像第一个示例代码?有没有办法像第一个示例代码一样强制 Proguard 优化方法?
我用dex2jar反编译,jd-gui查看。
感谢任何见解...
【问题讨论】:
标签: java android methods proguard