Skip to content

Instantly share code, notes, and snippets.

@f2prateek
Created January 20, 2015 09:19
Show Gist options
  • Save f2prateek/524603beb8a90776cb2f to your computer and use it in GitHub Desktop.
Save f2prateek/524603beb8a90776cb2f to your computer and use it in GitHub Desktop.
Print all classes in a DexFile
try {
File dexFileOutputDir = context.getDir("dexFileOutput" + fileKey, Context.MODE_PRIVATE);
File dexFileOutputFile = new File(dexFileOutputDir, "dex");
DexFile dx =
DexFile.loadDex(jarFile.getAbsolutePath(), dexFileOutputFile.getAbsolutePath(), 0);
// Print all classes in the DexFile
for (Enumeration<String> classNames = dx.entries(); classNames.hasMoreElements(); ) {
String className = classNames.nextElement();
System.out.println("class: " + className);
}
} catch (IOException e) {
throw new RuntimeException(e);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment