Exporting types from Android app using ClassyShark

Following my recent article I got a few suggestions asking to add a type analysis export to the ClassyShark output.

Types analysis is important for Android developers when dealing with deprecated apis, duplicate dependencies and security analysis.

The tricky part is: we need to pay attention to both app and library types. The app own types are easy, as one can see them in their IDE, however the dependencies are more difficult to grasp. On top of that, for Android there is no distinction between the types in the app and the ones in dependencies (like third party libraries).

For code inside the app a few surprises might come with inner classes and synthetic methods that add to class and method count (see the multidex limit) to the ClassyShark output, so in this article I would like to describe how to use this feature.

You can find the same minimalistic UI here and a released jar (classyshark-types-export.jar) here. Say hello ClassyShark Types Exporter a.k.a. exporter.

How to use the exporter? It is pretty easy:

  • Double click on the jar, the file chooser pops up
  • Select your APK
  • Once the APK is selected the exporter starts to export, showing the export progress that might take 30–40 secs (checked with MacBook Pro).
  • Once the exporter finishes the work, it creates a text file in the same folder as the running jar. This text file holds a list with all types from the APK

Happy coding!