This topic describes howDecompile the Android Application to view the source code, resource files, and XML files, modify the files, and package them into an APK.. We encourage people to decompile to learn others' designs, rather than confusing the market after changing the app shell. You can also directly use the anti-droid compiled by netizens.
Android APK is actually a Zip file, which can be decompressed and decompiled to view source code and resource files. For example:
Right-click the APK file and select Winrar compressed file manager as follows:
Is it similar to the program's directory structure? the source code has been compressed into the classes. dex file. Here we can directly view the image files under res, but the source code cannot be viewed, and the opening of xml files such as AndroidManifest. xml is also garbled.
Toolkit needed (as of the latest version in), including dex2jar, jd-gui, and apktool. You can also download the latest version as needed below.
1. View Source Code
(1) modify the file suffix .apk to .zip and decompress it with winrar to record the path of classes. dex.
(2) Use the android-reverse-trinea \ dex2jar-0.0.9.13 in the Toolkit or download the latest dex2jar and unzip it and run
Classes. Dex path
Classes_dex2jar.jarwill be generated in the classes.dex directory. Open this file with jd-gui.exe (use jd-gui in the Toolkit or download the latest version), as shown below:
We can get a general understanding of the code structure. Although the source code is poorly readable after proguard obfuscation, we can still find some information through keywords (non-obfuscated class names. However, jd-gui does not support source code search. It only supports search types, constructors, constants, attributes, and methods.
2. View resource files and XML files
(1) Use the Android-reverse-trinea \ apktool-1.5.2-windows in the Toolkit or download the latest apktool (you need to download the apktool and the corresponding platform dependency package at the same time, decompress the package to the platform dependency package in the apktool. jar to the apktool directory), and run
In this example, "dashboard" is unwrapped, "xxx.apk" is the path of the APK to be decompiled, and "XXX" is the name of the target folder. (apktool does not support Chinese directories:
The result will be apktool again. the Weixin folder is generated in the directory where BAT is located. Now, you can view the XML resources correctly (including all resources under Res, such as images, drawable, layout, value, and menu, for example, androidmanifest. XML
3. Modify the package and package it into an APK.
Still use the apktool in step 2. The command is as follows:Apktool. Bat B xxx
B Indicates build, xxx indicates the folder that is decompressed in step 2. We can modify a file and repackage it.
After packaging, the build and DIST folders are generated under the xxx directory. Dist stores the re-generated APK, and build stores the specific composition information of the APK.
Here we can simply replace the resource or modify the code by modifying smali. Do not do anything bad _*.
Original article: http://www.trinea.cn/android/