Reputation: 350
When using Proguard some methods bodies are replaced by this:
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'
// ...
}
while most of them have something like this:
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;
}
}
Why aren't they all like the first sample code? And is there a way to force Proguard to optimize methods like in the the first sample code?
Im using dex2jar to decompile and jd-gui to view it.
Any insight is appreciated...
Upvotes: 0
Views: 81
Reputation: 198103
There is no difference in what ProGuard does between these two methods.
The difference is in the tool you're using to read ProGuard's output: what bytecode it can and can't decompile to make it look like normal Java source.
Upvotes: 3