共计 1164 个字符,预计需要花费 3 分钟才能阅读完成。
使用的工具:
apktool,aapt,jdk 环境
这些工具的获取这里不再多说。
其中,aapt 是一个 32 位的工具,如果你的系统是 32 位的,那么无须做过多解释,如果是 64 位,那跟着我一起来折腾吧。
我们来反编译一个 apk 包:
apktool d yourapk.apk newdirectory
其中,d 参数表示 decode,反编译,yourapk 为你要反编译的 apk 名,newdirectory 表示解压到的新目录。
修改解压出来的文件后,再重新打包:
apktool b newdirectory yournewapk.apk
newdirectory 为反编译出来的目录,yournewapk 为新生成的文件名。
此时,你可能会碰到如下问题:
ld-linux-x86-64.so.2 ^ elf no such....
这里需要 安装 glibc.i686 库:
yum install glibc.i686
再次编译打包,又出现如下问题:
Exception in thread "main" aapt: error while loading shared libraries: libz.so.1: cannot open shared object file: No such file or directory
使用如下命令查询该库属于哪个安装包:
yum provides libz.so.1
查到结果如下:
zlib-1.2.3-29.el6.i686 : The zlib compression and decompression library
安装 zlib:
yum install zlib-1.2.3-29.el6.i686
编译打包,Again!!
MLGB,还有问题:
aapt: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory
继续查找该库属于哪个包,查询结果如下:
aapt: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory
更新libstdc++.so.6,为什么要更新?不然你可能会碰到:
Error: Protected multilib versions: libstdc++-4.4.7-11.el6.i686 != libstdc++-4.4.6-3.el6.x86_64
You could try using --skip-broken to work around the problem
yum update libstdc++.so.6
yum install glibc.i686
zlib.i686 libstdc++.i686
