工具下载
- apktool :https://ibotpeaches.github.io/Apktool/install
- dex2jar:https://github.com/pxb1988/dex2jar
- jd-gui:http://jd.benow.ca

根据apktool网站提示的下载方法,右击wrapper script,链接存储为apktool,不要带拓展名




这样环境就配好啦,打开终端,输入
apktool
命令,看到以下输出说明apktool配置成功

反编译
终端输入cd /Users/zachary/zachary/MyTest
进入到测试apk所在目录,输入apktool d test.apk
开始反编译


下载完dex2jar和 jd-gui解压一下就可以了,复制到MyTest目录方便操作

sh dex2jar-2.0/d2j-dex2jar.sh test.apk
(如果提示Permission Deny权限问题,先输入命令chmod +x dex2jar-2.0/d2j-dex2jar.sh
改一下权限就好了)



回编译
刚才我们执行apktool d test.apk
反编译得到了test目录

回编译就是执行命令
apktool b test




重新签名
复制签名文件到dist目录下方便操作

终端进入dist目录,执行命令
jarsigner -verbose -keystore [your_key_store_path] -signedjar [signed_apk_name] [usigned_apk_name] [your_key_store_alias] -digestalg SHA1 -sigalg MD5withRSA
字段说明:
- [your_key_store_path]:密钥所在位置的绝对路径
- [signed_apk_name]:签名后安装包名称
- [usigned_apk_name]:未签名的安装包名称
- [your_key_store_alias]:密钥的别名


签完名后,在dist目录下就可以看到签完名后的apk了

后话
反编译的时候,也可以把test.apk的拓展名改成test.zip解压出来


终端进入dex2jar-2.0路径下,执行命令
./d2j-dex2jar.sh classes.dex




网友评论