Is there a way to get count of number methods used in a jar file

Can i have the count of all methods used in a jar file . My APK uses certain external JARS and there are a number of classes around hundred to be precise.

I have used decompilers like dex2jar JAD and others to name a few ,but they all seem to show methods only in particular class file.

Is there a way i can get a total count ?

Answers


You can convert the jar to a dex file, and then pull the number of method references out of the header. It is stored as an unsigned little endian integer, at offset 88 (0x58).

dx --dex --output=temp.dex orig.jar
cat temp.dex | head -c 92 | tail -c 4 | hexdump -e '1/4 "%d\n"'

Keep in mind that this is the number of unique methods referenced, not the number of method references. In other words, if a particular method is referenced twice in the dex file, it will only be counted once in the count in the header. And when you import this jar into your apk, the method references that are common between the two are deduplicated, so the total method reference count of the final merged apk will be <= the sum of the two.


Need Your Help

How to call Java method in JavaFX menu

java javafx-2 javafx

I'm new to JavaFX. I created this simple menu.

How do I regex search for weird non-ASCII characters in Python?

python regex unicode ascii

I'm using the following regular expression basically to search for and delete these characters.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.