As a technical and product staff member of the company, I am really envious of the excellent Android APK developed by others. During the Android development process, I also want to learn how others create those beautiful animations and layouts, or product logic, so I recently learned how to decompile APK. I only use it for learning and reference to improve product competitiveness, and it will not be used for any illegal intentions. First download the decompilation software apktool, dex2jar, jd-gui to decompile the APK Tool Introduction: apktool: resource file acquisition, can extract image files and layout files for use and viewing, its principle details: (http://my.oschina.net/1590538xiaokai/blog/467830) dex2jar: decompile apk into java source code (convert classes.dex into jar file) jd-gui: View the jar file converted from classes.dex in APK, that is, the source code file Decompilation process: 1. Decompile apk to get the source code, pictures, XML configuration, language resources and other files of the program Download apktool from the above tools, decompress it to get 3 files: aapt.exe, apktool.bat, apktool.jar, put the APK file to be decompiled in the directory, open the command line interface (Run-CMD), locate 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 decompiled, and test is the name of the directory where the resource files are stored after decompilation, that is: apktool.bat d -f [apk file] [output folder]) It means the acquisition is successful. Then you will find a test file in the folder. Click it to view all the resource files of the application. If you want to repackage the decompiled file into an APK, you can enter apktool.bat b test (the folder you compiled), and the effect is as follows: After that, you can find two more folders under the previous test file: build dist (which stores the packaged APK file) 2. Decompile Apk to get Java source code Download dex2jar and jd-gui from the above tools, unzip the APK to be decompiled, change the suffix to .rar or .zip, and unzip it to get the classes.dex file (it is the java file compiled and packaged by the dx tool), put the obtained classes.dex into the previously unzipped tool dex2jar-0.0.9.15 folder, locate the directory where dex2jar.bat is located in the command line, enter dex2jar.bat classes.dex, the effect is as follows: a classes_dex2jar.jar file will be generated in the changed directory, and then open the jd-gui.exe in the tool jd-gui folder, and then use the tool to open the previously generated classes_dex2jar.jar file to see the source code, the effect is as follows: the obfuscated effect diagram (the class file name and the method name in it will be named in the style of a, b, c...). 3. Graphical decompilation of apk The above steps 1 and 2 describe command line decompilation of apk. Now we provide a graphical decompilation tool: Androidfby. First, download the above decompilation tool package, open the Androidfby directory, double-click the Android decompilation tool.exe, and you can browse and open the apk to be decompiled. Through decompilation, you can find out what third-party library files the application uses, how its code is written, and so on.
Of course, some APKs are obfuscated to avoid being decompiled by others. Because many criminals start pirating an APP by decompilation. So from the perspective of mobile application security, in order to prevent others from understanding the layout and logic of your APK, some decompilation protection measures should be taken, especially to avoid being seen by competitors. If developers do not want to be decompiled by others and improve the security of APK, encryption protection can be used. As an ordinary mobile developer, the purpose of decompilation is just to understand the general idea of other people's applications, which is beneficial rather than harmful to development work. |
<<: A detailed discussion of environmental sensors on mobile phones and related APIs in W3C
>>: How to improve the style of APP interface in details?
"Private domain" has almost become an u...
In order to better penetrate into various industr...
The emergence of the Internet has changed the way...
Although the SUV market is very hot now, the majo...
Audit expert: Peng Guoqiu Deputy Chief Physician,...
The more exaggerated, the more explosive? Totally...
According to a CNNIC report, the size of China...
Although many companies have the concept of conte...
Duck blood is a very common food ingredient, smoo...
What is the most mysterious place on the Earth...
Shanda's changes basically occurred after 200...
This article mainly introduces what to do if the ...
In recent years, with the launch of "Mini Pr...
With "Martian Breadcrumbs" - an unprece...
When it comes to domestic stranger social softwar...