This article is a rough introduction of how to use some tools, anti-compiling Android, to get the source code, I hope you have some help, the author's Android environment is 4.4.2.
1. Prepare resources.
Before you begin, you need to prepare three tools:
Apktool
Function: Resource file gets, can extract picture file and layout file for use view
Dex2jar
Role: Decompile the apk into Java source code (Classes.dex into a jar file)
Jd-gui
Role: View the apk in the Classes.dex converted into a jar file, namely the source file
2. Get the resource file
Use Apktool This tool to get the resource file, download Apktool will get three files: Aapt.exe, Apktool.bat, Apktool.jar,
Next you will need to put the anti-compilation apk file in this directory,
Open the Command line interface (run-cmd), navigate to the Apktool folder, and enter the following command: apktool.bat d-f test.apk test
(test.apk in the command refers to the full name of the APK file to be deserialized, and test is the directory name that is stored in the post-compilation resource file, i.e.: Apktool.bat d-f [apk file] [output folder])
After the description is successful, you find that you have more than one test file under the folder and click to view all the resource files for that app.
Open the resource file, you can see that there are res and Smali folder, res folder is placed in pictures and XML and other file resources, Smali inside the code, files are. smali format, inconvenient to read.
If you want to repackage the anti-compiled files into an apk, you can: Enter apktool.bat B Test (you compiled the folder) , the effect is as follows:
After that, you can find 2 more folders under the previous test file:
Dist (contains the packaged apk file)
3. Get Java source files
The second step to obtain the Smali file is not easy to read, then get the source code.
After downloading good dex2jar and Jd-gui, unzip
Change the name of the apk suffix you want to decompile to. rar or. zip, and unzip it to get the amount of the Classes.dex file (which is the Java file compiled and then packaged with the DX tool),
Put the acquired classes.dex into the previously extracted tool dex2jar-0.0.9.15 folder,
Under the command line to locate the Dex2jar.bat directory, enter dex2jar.bat classes.dex , the effect is as follows:
(The name of the class file and the name of the method inside will be a,b,c ...). Style name):
This way can be anti-compilation, but after the author's test, found that the anti-compiled source files, more or less have some errors.
Original link: Android apk anti-compilation
"Android" Android how to Decompile apk