Skip to content

Instantly share code, notes, and snippets.

@vsahu1986
Forked from JakeWharton/dex.sh
Last active September 20, 2015 18:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vsahu1986/ed749208b2009bae7c21 to your computer and use it in GitHub Desktop.
Save vsahu1986/ed749208b2009bae7c21 to your computer and use it in GitHub Desktop.
`classes.dex` method count helpers. Requires smali/baksmali from https://code.google.com/p/smali/ and dexdump from the build-tools in the Android SDK be on your PATH.
function dex-method-count() {
cat $1 | head -c 92 | tail -c 4 | hexdump -e '1/4 "%d\n"'
}
function dex-method-count-by-package() {
dir=$(mktemp -d -t dex)
baksmali $1 -o $dir
for pkg in `find $dir/* -type d`; do
smali $pkg -o $pkg/classes.dex
count=$(dex-method-count $pkg/classes.dex)
name=$(echo ${pkg:(${#dir} + 1)} | tr '/' '.')
echo -e "$count\t$name"
done
rm -rf $dir
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment