This repository was archived by the owner on Jul 22, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +36
-0
lines changed
ClassySharkWS/src/com/google/classyshark Expand file tree Collapse file tree 2 files changed +36
-0
lines changed Original file line number Diff line number Diff line change 19
19
import com .google .classyshark .silverghost .SilverGhostFacade ;
20
20
21
21
import java .io .File ;
22
+ import java .util .LinkedList ;
22
23
import java .util .List ;
23
24
24
25
import static com .google .classyshark .silverghost .SilverGhostFacade .getGeneratedClassString ;
@@ -74,7 +75,16 @@ public List<String> getAllStrings() {
74
75
return SilverGhostFacade .getAllStrings (archiveFile );
75
76
}
76
77
78
+ /**
79
+ *
80
+ * @return
81
+ */
82
+ public boolean isMultiDex () {
83
+ return SilverGhostFacade .isMultiDex (archiveFile );
84
+ }
85
+
77
86
public static void main (String [] args ) {
87
+
78
88
File apk =
79
89
new File ("/Users/bfarber/Desktop/Scenarios/3 APKs/"
80
90
+ "com.google.samples.apps.iosched-333.apk" );
@@ -86,5 +96,6 @@ public static void main(String[] args) {
86
96
System .out .println (shark .getManifest ());
87
97
System .out .println (shark .getAllMethods ());
88
98
//System.out.println(shark.getAllStrings());
99
+ System .out .println (shark .isMultiDex ());
89
100
}
90
101
}
Original file line number Diff line number Diff line change @@ -154,4 +154,29 @@ public static void exportArchive(List<String> args) {
154
154
System .err .println ("Internal error - couldn't write file" );
155
155
}
156
156
}
157
+
158
+ /** returns true if the apk is multidex
159
+ *
160
+ * @param archiveFile
161
+ * @return
162
+ */
163
+ public static boolean isMultiDex (File archiveFile ) {
164
+ ContentReader contentReader = new ContentReader (archiveFile );
165
+ contentReader .load ();
166
+
167
+ List <String > allClassNames = contentReader .getAllClassNames ();
168
+ int numDexes = 0 ;
169
+
170
+ for (String classEntry : allClassNames ) {
171
+ if (classEntry .endsWith (".dex" )) {
172
+ numDexes ++;
173
+ // 2 dexes or more + optimization
174
+ if (numDexes == 2 ) {
175
+ return true ;
176
+ }
177
+ }
178
+ }
179
+
180
+ return false ;
181
+ }
157
182
}
You can’t perform that action at this time.
0 commit comments