if [ "$#" -ne 1 -a "$#" -ne 2 ];then echo "Delete support-v4/v7/v13 classes in dex or apk. Usage: ./del-support.sh input-dex/apk [output-dex/apk] Sample: ./del-support.sh classes.dex out.dex ./del-support.sh input.apk output.apk Author: LeadroyaL Time: 2018/3/5" exit fi
echo "GOGOGO!"
if [[ $1 == *.dex ]];then echo "dex file!" t=dex filename=${1%%.dex} fi if [[ $1 == *.apk ]];then echo "apk file!" t=apk filename=${1%%.apk} fi echo type is $t and filename is $filename if [[ $t == apk ]];then unzip $1 classes.dex fi
java -jar baksmali.jar d $1 rm -rf out/android/support/ java -jar smali.jar a out/
if [ "$#" -eq 1 ];then if [[ $t == apk ]];then o="output.apk" else o="out.dex" fi else o=$2 fi
if [[ $t == apk ]];then if [[ $o != *.apk ]];then o=$o.apk else o=$o fi mv out.dex classes.dex cp $1 $o zip $o -u classes.dex else mv out.dex $o fi
➜ /tmp ./del-support.sh app-debug.apk GOGOGO! apk file! type is apk and filename is app-debug Archive: app-debug.apk replace classes.dex? [y]es, [n]o, [A]ll, [N]one, [r]ename: y inflating: classes.dex updating: classes.dex (deflated 69%) Success and output.apk generated. ➜ /tmp ./del-support.sh classes.dex GOGOGO! dex file! type is dex and filename is classes Success and out.dex generated.