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

前端 未结 12 2198
粉色の甜心
粉色の甜心 2020-11-28 03:20

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 use

12条回答
  •  南方客
    南方客 (楼主)
    2020-11-28 03:49

    I wrote a script based on @JesusFreke's answer for this problem and for another problem (https://stackoverflow.com/a/21485222/6643139):

    #!/bin/bash
    unzip $1 classes.jar -d aarsize &&
      dx --dex --output=aarsize/temp.dex aarsize/classes.jar &&
      hexdump -s 88 -n 4 -e '1/4 "%d\n"' aarsize/temp.dex &&
      rm -rf aarsize
    

    Save it to a file name "aarsize", chmod +x for it, output of aarsize your_aar_file :

    $ aarsize status-bar-compat-release.aar 
    Archive:  status-bar-compat-release.aar
      inflating: aarsize/classes.jar     
    91
    

    The 91 is the method counts of your aar file.

提交回复
热议问题