Exporting types from Android App Using ClassyShark
In this post, MVB Boris Farber gives a quick tutorial on how to export types from an Android mobile application, using the tool ClassyShark.
Join the DZone community and get the full member experience.Join For Free
Following my recent article, I got a few suggestions asking about adding 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.
How do you use the exporter? It is pretty easy:
- Double click on the jar, and then 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.
Published at DZone with permission of Boris Farber, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.