Counting mumber of methods on jars found in a directory
Submitted by drjunior on Thu, 03/20/2014 - 10:24
Very very very helpful when the apk reach the max of 64K method limit. "java.lang.IllegalArgumentException: Dex method index overflow [65643]"
totalmethods=0
for jar in `find . -type f -name "*.jar"`; do
echo $jar
dx --dex --output=temp.dex $jar 2> /dev/null
jarmethods=$(cat temp.dex | head -c 92 | tail -c 4 | hexdump -e '1/4 "%d\n"')
echo $jarmethods
totalmethods=$(($a+$totalmethods))
echo $totalmethods
done
Here is a list of libraries that worth mentioning:
- com.google.android.gms:play-services 8112 methods
- rhino-1.7 7323 methods
- jackson-mapper-asl-1.9.2 5132 methods
- support-v4-19.0.1 5301 methods
- com.android.support:appcompat-v7 5300 methods
- google-api-services-drive-v2 2643 methods
- gson-2.1 1080 methods
- Log in to post comments
Comments
Update
Use this awesome java tool to effectively analyze the number of methods in an apk.
https://github.com/mihaip/dex-method-counts