Tool name, Introduction and :
Apktool (get resource file)
Function: Get the resource file, can extract the picture file and layout file for use view.
Download Address:
Dex2jar ( get source files)
Role: Decompile the apk into Java source code (Classes.dex into a jar file).
:
Jd-gui( view source)
Role: View the apk in the Classes.dex converted into a jar file, namely the source file
Download Address:
Anti-compilation process:
First, APK anti-compilation to get the program's source code, pictures, XML configuration, language resources and other files
Download the Apktool in the above tool to extract 3 files: Aapt,apktool,apktool.jar,
Put the apk file that you want to decompile into the directory,
Open the Command line interface (that is, the terminal), Navigate to the Apktool folder and enter the following command:./Apktool d-f demo.apk demo
Note:./indicates the current directory
(demo.apk in the command refers to the full name of the APK file to be deserialized, the directory name of the demo for the post-compilation resource file, which is :./apktool d-f [apk file] [output folder])
After the anti-compilation is complete, the directory structure is as follows:
After the instructions were successful, I found that there was a demo folder under the folder and clicked to see all the resource files for that app.
If you want to repackage the anti-compiled files into an apk, you can enter the./apktool b Demo (just compiled folder), the effect is as follows:
After that, you can find 2 more folders under the previous demo file:
Build
Dist (contains the packaged apk file)
Second, apk anti-compilation to get Java source code
Download the Dex2jar and Jd-gui in the tools above and unzip.
change the name of the apk suffix you want to decompile to. rar or. zip, and unzip to get one of the Classes.dex Files ( It is a file compiled by Java files and then packaged with DX tools. ), such as:
will get to the Classes.dex and put it in a previously extracted tool. dex2jar-0.0.9.15 folder inside, at the command line, navigate to the Dex2jar.bat directory, enter Dex2jar.bat classes.dex, the effect is as follows:
In this directory, a classes_dex2jar.jar file is generated, then the JD-GUI.DMG in the tool Jd-gui folder is opened, and the tool is opened before the Classes_dex2jar.jar file, you can see the source code, the effect is as follows:
(The name of the class file and the name of the method inside will be a,b,c ...). Style naming).
By decompile, you can learn about the third-party library files that the app uses, how the code is written, and so on. However, if the APK is obfuscated, then the name of the class file you see and the name of the method inside will be a,b,c .... Style naming, so you can find that you want to know the interface code may be very laborious, found the code may seem to be very laborious, but a general idea will be obtained, with this idea, you can try it yourself.
Reference:
Android apk Anti-compilation is so simple (Windows edition)
Confusing reference tutorial:How Android prevents the APK program from being decompile
Android APK anti-compilation tool use and tool download (MAC)