Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Android Dex Method Count more sophisticated scripts that gives you method cound by package @JakeWharton https://gist.github.com/JakeWharton/6002797 and @tsmith https://gist.github.com/tyvsmith/6056422
You can add this to your shell profile and then use it as dexcount file.
This file should have a classes.dex in order to work, that means it has to be a android lib project or android apk.
count(){
mkdir temp >/dev/null
cp $1 temp/$1+copy > /dev/null
unzip temp/$1+copy -d temp/ > /dev/null
cat temp/classes.dex | head -c 92 | tail -c 4 | hexdump -e '1/4 "%d\n"'
rm -R temp > /dev/null
}
alias dexcount='count'
@blundell

This comment has been minimized.

Copy link

@blundell blundell commented Aug 3, 2014

👍

@senechaux

This comment has been minimized.

Copy link

@senechaux senechaux commented Aug 4, 2014

Para que funcione en Mac hay que cambiar la línea del unzip para añadir el modificador "-d":
unzip temp/$1+copy -d temp/ > /dev/null

Por otro lado la primera línea no tiene mucho sentido, no? dejas una copia del .apk en el propio directorio y luego creas una nueva en la carpeta temp. A mí me ha quedado tu script así:

count(){
 `mkdir temp >/dev/null`
 `cp $1 temp/$1+copy > /dev/null`
 `unzip temp/$1+copy -d temp/ > /dev/null`
 cat temp/classes.dex | head -c 92 | tail -c 4 | hexdump -e '1/4 "%d\n"'
 rm -R temp > /dev/null 
}

En cualquier caso muchas gracias, gran trabajo!

@rallat

This comment has been minimized.

Copy link
Owner Author

@rallat rallat commented Aug 5, 2014

Gracias! tienes toda la razón. He actualizado el código, además era el que estaba usando ya en mi profile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.