Last active
November 7, 2019 01:59
-
-
Save caojianhua/753ec4e456b5ce7ec65a22d68ce5ba24 to your computer and use it in GitHub Desktop.
计算jar包文件中的方法总数
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
# 获得输入的jar文件 | |
JAR_FILE=$1; | |
# 这里直接使用dx命令,是因为我已经提前配置好了环境变量,dx目录位于: | |
# $ANDROID_HOME/sdk/build-tools/android-4.3.1/dx | |
dx --dex --verbose --no-strict --output=temp.dex $JAR_FILE > /dev/null | |
# 计算jar包中的方法数 | |
METHOD_COUNT=`cat temp.dex | head -c 92 | tail -c 4 | hexdump -e '1/4 "%d\n"'` | |
# 显示结果 | |
echo $METHOD_COUNT | |
# 删除临时文件temp.dex | |
rm -f temp.dex |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment