I originally wanted to write something at the beginning to set off this article, but considering that it is not a glorious thing to teach you this type of decompilation here, just save it ...... Go straight to the topic!
Note:
This method is for reference only and not commercial. It is only for learning and communication. When this method is used to decompile Android applications,
Please consciously respect the intellectual property rights of the original author of the android application. Thank you.!
1. Prepare required tools
To decompile Android applications, three tools are required:
1. apktool .)
2, JD-GUI (Official download URL http://java.decompiler.free.fr /? Q = jdgui)
3, dex2jar (Official download URL http://code.google.com/p/dex2jar ).
All of the above are official ones. Visitors can download them from the corresponding official website. For your convenience, I have compiled the above three tools. If you are interested, you can take a look at them at http://download.csdn.net/detail/p000034/4379279.
Ii. decompile Android Application
Two steps are required to decompile the APK application:
1. Obtain the Java class of the application
The tool used for this step is dex2jar and JD-GUI.
Specifically,
First, change the suffix of the ***. APK file to ***. Zip or ***. rar. Then decompress the ***. Zip or ***. rar file using the decompression tool to obtain a file named classes. Dex.
Unzip the folder a that decompress the dex2jar.zip file, and put the classes. Dex file obtained above into the folder. Run cmd To Go To The a folder and run "dex2jar. Bat classes. Dex" to generate a new file named classes. Dex. dex2jar. jar in the folder.
Decompress the jd-gui.rarfile to obtain the jd-gui.exe application. Double-click the application and open the file named classes. Dex. dex2jar. Jar above to view all Java classes used in the Android Application.
2. Obtain XML files, image files, or audio files
In fact, through the above steps, we can sometimes obtain XML files, image files, or audio files, however, sometimes we use a text editor to open XML files that are decompiled according to this method, garbled characters may occur. To obtain XML files, image files, or audio files, we sometimes have to use the following methods.
The tool used in this step is apktool.
This step is relatively simple. You only need to put the ***. APK file in the root directory of drive C (Windows System Disk.
.).
Run cmd to enter the decompressed folder of apktool, and run "apktool D xxx.apk ABC" (decompiling xxx.apk to the folder ABC ).
In this case, you can use a text editor to open the XML files stored in the ABC folder without garbled characters.
Through the above two steps, we can obtain the decompilation source code of the APK we need.