ProGuard kommentiert Methoden aus

  • Antworten:3
TheEvilOne
  • Forum-Beiträge: 311

13.03.2013, 12:11:11 via Website

Hallo,

ich habe eben meine App dekompiliert und da ist mir aufgefallen, dass ProGuard in 2 Klassen Methoden auskommentiert und oben drüber // ERROR // über die Methoden schreibt.

Die Methoden scheinen aber in der App, wenn ich sie installiert habe, aufgerufen und ohne Fehler verwendet zu werden.

Ich habe Google bemüht, aber leider nichts dazu gefunden. Daher wollte ich hier mal in die Runde fragen, ob das jemand kennt bzw. mir sagen kann, was da los ist.

Ich habe in der ProGuard-Konfiguration bereits die beiden Klassen ausgeschlossen mit keep public class... Aber die Methoden werden am Ende dennoch von ProGuard auskommentiert.

Hier meine ProGuard-Konfiguration:
1# To enable ProGuard in your project, edit project.properties
2# to define the proguard.config property as described in that file.
3#
4# Add project specific ProGuard rules here.
5# By default, the flags in this file are appended to flags specified
6# in ${sdk.dir}/tools/proguard/proguard-android.txt
7# You can edit the include path and order by changing the ProGuard
8# include property in project.properties.
9#
10# For more details, see
11# http://developer.android.com/guide/developing/tools/proguard.html
12
13# Add any project specific keep options here:
14
15# If your project uses WebView with JS, uncomment the following
16# and specify the fully qualified class name to the JavaScript interface
17# class:
18#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
19# public *;
20#}
21-dontwarn android.support.v4.**
22
23-keep class android.support.v4.app.** { *; }
24-keep interface android.support.v4.app.** { *; }
25-keep class com.actionbarsherlock.** { *; }
26-keep interface com.actionbarsherlock.** { *; }
27
28-keepattributes *Annotation*
29
30
31-keepclassmembers enum * {
32 public static **[] values();
33 public static ** valueOf(java.lang.String);
34}
35
36-keep class * implements android.os.Parcelable {
37 public static final android.os.Parcelable$Creator *;
38}
39
40
41-keepnames class * implements java.io.Serializable
42
43-keepclassmembers class * implements java.io.Serializable {
44 static final long serialVersionUID;
45 private static final java.io.ObjectStreamField[] serialPersistentFields;
46 !static !transient <fields>;
47 !private <fields>;
48 !private <methods>;
49 private void writeObject(java.io.ObjectOutputStream);
50 private void readObject(java.io.ObjectInputStream);
51 java.lang.Object writeReplace();
52 java.lang.Object readResolve();
53}
54
55-keep class com.android.vending.billing.**
56
57-keep public class * extends android.app.Service

Und hier eine der dekompilierten Klassen:
1package de.crimescenetracker.helper;
2
3import android.app.Service;
4import android.content.Intent;
5import android.content.ServiceConnection;
6import android.os.IBinder;
7import com.android.vending.billing.IInAppBillingService;
8
9public class PCS extends Service
10{
11 private IInAppBillingService a;
12 private ServiceConnection b = new j(this);
13
14 // ERROR //
15 public final void a()
16 {
17 // Byte code:
18 // 0: aload_0
19 // 1: getfield 22 de/crimescenetracker/helper/PCS:a Lcom/android/vending/billing/IInAppBillingService;
20 // 4: iconst_3
21 // 5: aload_0
22 // 6: invokevirtual 30 de/crimescenetracker/helper/PCS:getPackageName ()Ljava/lang/String;
23 // 9: ldc 32
24 // 11: aconst_null
25 // 12: invokeinterface 37 5 0
26 // 17: astore_2
27 // 18: aload_2
28 // 19: ifnull +255 -> 274
29 // 22: aload_2
30 // 23: ldc 39
31 // 25: invokevirtual 45 android/os/Bundle:getInt (Ljava/lang/String;)I
32 // 28: ifne +194 -> 222
33 // 31: aload_2
34 // 32: ldc 47
35 // 34: invokevirtual 51 android/os/Bundle:getStringArrayList (Ljava/lang/String;)Ljava/util/ArrayList;
36 // 37: astore 4
37 // 39: aload_2
38 // 40: ldc 53
39 // 42: invokevirtual 51 android/os/Bundle:getStringArrayList (Ljava/lang/String;)Ljava/util/ArrayList;
40 // 45: astore 5
41 // 47: aload 4
42 // 49: invokevirtual 59 java/util/ArrayList:size ()I
43 // 52: ifne +223 -> 275
44 // 55: aload 5
45 // 57: invokevirtual 59 java/util/ArrayList:size ()I
46 // 60: ifne +215 -> 275
47 // 63: invokestatic 64 de/crimescenetracker/helper/m:a ()Lde/crimescenetracker/helper/m;
48 // 66: aload_0
49 // 67: invokevirtual 68 de/crimescenetracker/helper/PCS:getApplicationContext ()Landroid/content/Context;
50 // 70: invokevirtual 72 de/crimescenetracker/helper/m:c (Landroid/content/Context;)V
51 // 73: goto +201 -> 274
52 // 76: iload 6
53 // 78: aload 5
54 // 80: invokevirtual 59 java/util/ArrayList:size ()I
55 // 83: if_icmplt +39 -> 122
56 // 86: iload 7
57 // 88: ifne +186 -> 274
58 // 91: invokestatic 64 de/crimescenetracker/helper/m:a ()Lde/crimescenetracker/helper/m;
59 // 94: aload_0
60 // 95: invokevirtual 68 de/crimescenetracker/helper/PCS:getApplicationContext ()Landroid/content/Context;
61 // 98: invokevirtual 72 de/crimescenetracker/helper/m:c (Landroid/content/Context;)V
62 // 101: getstatic 77 de/crimescenetracker/activities/MainActivity:a Landroid/widget/Button;
63 // 104: ifnull +170 -> 274
64 // 107: getstatic 77 de/crimescenetracker/activities/MainActivity:a Landroid/widget/Button;
65 // 110: iconst_0
66 // 111: invokevirtual 83 android/widget/Button:setVisibility (I)V
67 // 114: goto +160 -> 274
68 // 117: astore 12
69 // 119: goto +155 -> 274
70 // 122: aload 5
71 // 124: ifnull +19 -> 143
72 // 127: aload 5
73 // 129: invokevirtual 59 java/util/ArrayList:size ()I
74 // 132: ifle +11 -> 143
75 // 135: aload 5
76 // 137: iload 6
77 // 139: invokevirtual 87 java/util/ArrayList:get (I)Ljava/lang/Object;
78 // 142: pop
79 // 143: aload 4
80 // 145: ifnull +123 -> 268
81 // 148: aload 4
82 // 150: invokevirtual 59 java/util/ArrayList:size ()I
83 // 153: ifle +115 -> 268
84 // 156: aload 4
85 // 158: iload 6
86 // 160: invokevirtual 87 java/util/ArrayList:get (I)Ljava/lang/Object;
87 // 163: checkcast 89 java/lang/String
88 // 166: astore 8
89 // 168: aload 8
90 // 170: ifnull +91 -> 261
91 // 173: aload_0
92 // 174: invokevirtual 68 de/crimescenetracker/helper/PCS:getApplicationContext ()Landroid/content/Context;
93 // 177: aload 8
94 // 179: invokestatic 94 de/crimescenetracker/helper/k:a (Landroid/content/Context;Ljava/lang/String;)Z
95 // 182: ifeq +79 -> 261
96 // 185: invokestatic 64 de/crimescenetracker/helper/m:a ()Lde/crimescenetracker/helper/m;
97 // 188: aload_0
98 // 189: invokevirtual 68 de/crimescenetracker/helper/PCS:getApplicationContext ()Landroid/content/Context;
99 // 192: invokevirtual 96 de/crimescenetracker/helper/m:b (Landroid/content/Context;)V
100 // 195: iconst_1
101 // 196: istore 9
102 // 198: getstatic 77 de/crimescenetracker/activities/MainActivity:a Landroid/widget/Button;
103 // 201: ifnull +11 -> 212
104 // 204: getstatic 77 de/crimescenetracker/activities/MainActivity:a Landroid/widget/Button;
105 // 207: bipush 8
106 // 209: invokevirtual 83 android/widget/Button:setVisibility (I)V
107 // 212: iinc 6 1
108 // 215: iload 9
109 // 217: istore 7
110 // 219: goto -143 -> 76
111 // 222: invokestatic 64 de/crimescenetracker/helper/m:a ()Lde/crimescenetracker/helper/m;
112 // 225: aload_0
113 // 226: invokevirtual 68 de/crimescenetracker/helper/PCS:getApplicationContext ()Landroid/content/Context;
114 // 229: invokevirtual 72 de/crimescenetracker/helper/m:c (Landroid/content/Context;)V
115 // 232: getstatic 77 de/crimescenetracker/activities/MainActivity:a Landroid/widget/Button;
116 // 235: ifnull +39 -> 274
117 // 238: getstatic 77 de/crimescenetracker/activities/MainActivity:a Landroid/widget/Button;
118 // 241: iconst_0
119 // 242: invokevirtual 83 android/widget/Button:setVisibility (I)V
120 // 245: goto +29 -> 274
121 // 248: astore_3
122 // 249: goto +25 -> 274
123 // 252: astore_1
124 // 253: goto +21 -> 274
125 // 256: astore 10
126 // 258: goto -46 -> 212
127 // 261: iload 7
128 // 263: istore 9
129 // 265: goto -53 -> 212
130 // 268: aconst_null
131 // 269: astore 8
132 // 271: goto -103 -> 168
133 // 274: return
134 // 275: iconst_0
135 // 276: istore 6
136 // 278: iconst_0
137 // 279: istore 7
138 // 281: goto -205 -> 76
139 //
140 // Exception table:
141 // from to target type
142 // 101 114 117 java/lang/Exception
143 // 232 245 248 java/lang/Exception
144 // 0 101 252 android/os/RemoteException
145 // 101 114 252 android/os/RemoteException
146 // 127 195 252 android/os/RemoteException
147 // 198 212 252 android/os/RemoteException
148 // 222 232 252 android/os/RemoteException
149 // 232 245 252 android/os/RemoteException
150 // 198 212 256 java/lang/Exception
151 }
152
153 public IBinder onBind(Intent paramIntent)
154 {
155 return null;
156 }
157
158 public void onCreate()
159 {
160 super.onCreate();
161 }
162
163 public void onDestroy()
164 {
165 if (this.b != null);
166 try
167 {
168 unbindService(this.b);
169 label15: super.onDestroy();
170 return;
171 }
172 catch (Exception localException)
173 {
174 break label15;
175 }
176 }
177
178 public void onStart(Intent paramIntent, int paramInt)
179 {
180 super.onStart(paramIntent, paramInt);
181 bindService(new Intent("com.android.vending.billing.InAppBillingService.BIND"), this.b, 1);
182 }
183}

Antworten
TheEvilOne
  • Forum-Beiträge: 311

13.03.2013, 12:53:25 via Website

Ich habe das eben nochmal genau geprüft:

Die Methoden der betroffenen Klassen werden aufgerufen und funktionieren. Aber wieso Kommentiert ProGuard dann mit diesem // ERROR // Tag aus?

Ich verstehs nicht.

Antworten
Rafael K.
  • Forum-Beiträge: 2.359

13.03.2013, 13:16:07 via Website

Bist Du sicher, dass Proguard das macht?
Es könnte doch genauso gut sein, dass der Decompiler die Methode auskommentiert hat, weil es bereits einen class-member gibt, der a heißt.

Decompiler sind so eine Sache.
Auf dem Desktop genauso: Jad liefert Code wo einem teilweise schlecht wird. Mit Goto: Befehlen ^^

TheEvilOne

Antworten
TheEvilOne
  • Forum-Beiträge: 311

13.03.2013, 13:19:57 via Website

Aaaaaah, Danke für den Hinweis. Daran habe ich noch überhaupt nicht gedacht!

Das wirds sein. Denn wenn die Methoden wirklich auskommentiert wären, dann dürften sie auch nicht funktionieren :)

Ich habe dex2jar zum Dekompilieren benutzt.

Antworten