Decompile Android APK under Mac

Preparations: Install ApkTool, dex2jar, JD-GUI

Install ApkTool

1. Download ApkTool. You can download ApkTool from https://ibotpeaches.github.io/Apktool/install/

2. Install ApkTool

(1) Prepare the downloaded apktool file and apktool_2.4.0.jar file, and rename apktool_2.4.0.jar to apktool.jar;

(2) Move apktool.jar and apktool to the /usr/local/bin directory (you can open this directory by outputting the command open /usr/local/bin in the terminal);

(3) Add executable permissions to the above two files, that is, enter and execute in the terminal:

chmod +x apktool.jar
 chmod +x apktool

(4) Enter apktool in the terminal to see if it can run. If not, you need to open the security and privacy in the system preferences and click to still run apktool.jar;

Install dex2jar

You can download dex2jar from https://sourceforge.net/projects/dex2jar/files/

Install JD-GUI

You can download JD-GUI from http://jd.benow.ca/

1. Use ApkTool to decompile APK to get xml file, AndroidManifest.xml and pictures

cd [apkdir]
apktool d xxx.apk //该命令执行后会在同级目录下生成一个与你编译的apk同名的目录

The apk can be decompiled through the above command.

2. dex2jar decompiles dex into jar

The first step, unzip the apk to get the dex file

Use the decompression software to decompress the apk (directly change the suffix name to .zip) to get the classes.dex file. Sometimes there are multiple classes.dex files (this is due to the application of MultiDex). Copy the classes.dex file to the downloaded and decompressed dex2jar directory. Then execute the following code to decompile:

cd [你的dex2jar解压目录] 
sh d2j-dex2jar.sh classes.dex
sh d2j-dex2jar.sh classes2.dex

One or more .jar files will be obtained through the above command (a classes.dex generates a jar file)

3、使用JD-GUI查看反编译后的程序源码

将dex转换成jar之后接下来我们就可以使用JD-GUI来查看反编译后的程序源码了

操作步骤很简单,只需双击运行jd-gui-1.4.0.jar,然后将classes-dex2jar.jar拖拽到JD-GUI界面上即可

Guess you like

Origin blog.csdn.net/TiktokLiveTool/article/details/130571329