Current location - Health Preservation Learning Network - Slimming men and women - How to decompile APK
How to decompile APK
How to decompile APK

When we download some apk, we may always want to learn how others program or use xml file layout. At this time, we thought of changing the suffix of apk file to rar and then decompressing it. Finally, we got some picture resources and many open files are garbled. Obviously, this method is not feasible, so we need to use the following tools to decompile apk.

1. Tool preparation: apktool, dex2jar, jd-gui.

Toolkit can also be downloaded here.

1, dex2jar can be downloaded here, and jd-gui can be downloaded here.

2.apktool, which can be downloaded from Google, contains two packages: apktool-1.0.tar.bz2 (including apktool.jar) and apktool-install-Windows-2.1_ r 0/kloc-0. Unzip apktool.jar to C:\Windows, and unzip apktool-install-windows.zip to any folder (such as the root directory of E disk).

Second, use dex2jar+jd-gui to get the java source code of apk. The steps are as follows:

1. Use to open the apk document. Rar, extract the classes.dex file, and then decompile it into a. jar file with tools.

Enter the path of dex2jar.bat under cmd, and then enter "dex2jar.bat XXX", XXX refers to the path and name of the classes.dex file in the apk you want to decompile. For example, my dex2jar.bat is under the path of d: \ Android \ APK _ decode \ dex2jar-0.0.7-snapshot. Classes.dex is under D:\Android, so after you enter the path of dex2jar.bat, enter dex2jar.bat d: \ Android \ classes.dex, and a jar file will be generated.

2. obtained by decompiling. Jar file into. Java file with jd-gui decompiler.

Third, use apktool to get the xml file of apk.

1 and Win+R run CMD, use the cd command to go to the folder where apktool-install-windows is located, and enter the command:

Apktool d XXX.apk ABC decompiles XXX.apk to the folder ABC.

2. You can get the xml configuration file of apk in the unzipped folder.

Fourthly, the program source code obtained in the second step and the xml record group obtained in the third step will become an android project, and the complete apk source code can be obtained.