B.B.
B.B.

Reputation: 954

Count number of method in a Library (Jar/AAR)

How do we count the number of methods in a Library file.

For eg, a Jar or AAR.

This is required to know the number of android resource IDs used by the library used by the project. This would help in estimating how close we are to 65K dex limit in Android.

Upvotes: 7

Views: 6092

Answers (3)

Jing Li
Jing Li

Reputation: 15116

  • dexcount-gradle-plugin: gradle plugin, works for any Android project (library or application), nice D3 sunburst partition chart output.
  • dex-method-counts: command-line tool, supports apk / zip / dex / directory.
  • Methods Count: only works for online public library, just give library 'compile' statement (e.g., com.google.code.gson:gson:2.4).
  • APK method count: only works for APK, expandable tree results.

Upvotes: 10

Orest Savchak
Orest Savchak

Reputation: 4569

I've created a small shell script that uses a solution, provided on other StackOverflow Answer for jar files. Maybe still could be useful. It takes AAR file and returns methods count. But you have to have Android SDK installed for that.

Upvotes: 1

Aritra Roy
Aritra Roy

Reputation: 15625

Why don't you give this site a try, MethodsCount. It also gives you with an awesome Android Studio plugin which add method count beside all your libraries in the build.gradle file.

You can also try this and this. I have tried both of them and they are worth checking.

Upvotes: 3

Related Questions