First, let's talk about the APK structure. APK is compressed in ZIP format, which can be easily decompressed.
The structure of an APK file is:
The META-INF \ JAR file is often seen
Res \ directory for storing resource files
Androidmanifest. xmlProgramGlobal configuration file
Classes. Dex Dalvik bytecode
Resources. ARSC compiled binary resource file
The text file in APK is binary.
If we only want to view the manifest information of the APK. You can use the aapt command.
The naming format is:
Aapt dump badging *. APK (here *. APK is your APK name)
The aapt command can be found in the tools folder of the corresponding SDK version:
This is my path: C: \ Android-SDK-Windows \ platforms \ Android-7 \ tools
For files in the res directory, you need to use tools to read and generate text files. axmlprinter2 of android4me is a good choice.
:
Http://code.google.com/p/android4me/downloads/detail? Name = axmlprinter2.jar & can = 2 & Q =
Usage:
Java-jar axmlprinter2.jar capture. xml> test. xml
After the command is executed, the standard output capture. XML is written to the test. xml file.
Next let's start decompilation.Code. Decompilation code requires two tools:
- Dex2jar, used to convert Dex files to jar files;
- JD-Gui: reverse engineer the JAR file into Java code.
Dex2jar address: http://code.google.com/p/dex2jar/
Decompress the package and run the dex2jar command:
Dex2jar. Sh classes. Dex
After the command is executed, a file named classes. Dex. dex2jar. jar is generated in this folder.
JD-Gui is divided into three versions: Windows, Mac, and Linux. Download the corresponding version.
Address of JD-Gui: http://java.decompiler.free.fr /? Q = jdgui
Download and decompress the package. Click the execution file. Drag the JAR file generated by dex2jar into the jd_gui to generateSource code.
How to export programs installed on your mobile phone:
copy the APK file to sdcard. The command order is as follows:
* Go To The Android SDK Folder/tools directory
* enter ADB shell
* enter su
* enter CD Data
* enter the CD app
now you can see all the APK files you have installed. Enter the APK space/sdcard/
corresponding to the CP space to copy the APK file.
change the suffix of the APK file to the RAR format. You can see the familiar directory structure.