Skip to content

Instantly share code, notes, and snippets.

@mente
Last active August 29, 2015 13:59
Show Gist options
  • Save mente/10651383 to your computer and use it in GitHub Desktop.
Save mente/10651383 to your computer and use it in GitHub Desktop.
calculate total number of methods in dex files
#!/usr/bin/env sh
dxPath="/Applications/Android Studio.app/sdk/build-tools/android-4.4/dx"
jarDir=build/pre-dexed/debug
rm temp.dex
sum=0
line='-----------------------------------------------------------------------------------------------------------------------'
for file in $jarDir/*.jar; do
"$dxPath" --dex --output=temp.dex $file
curr=`cat temp.dex| head -c 92 | tail -c 4 | hexdump -e '1/4 "%d\n"'`
printf "%s %s $curr\n" $file "${line:${#file}}"
let "sum += $curr"
done
file=TOTAL
printf "%s %s $sum\n" $file "${line:${#file}}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment