Decompile and Recompile APK Files with Ease
There are times when you might feel that you need few modifications in our favorite APPs. Who says that there is no way to do that is wrong. There is a way to achieve this by decompiling the APK file and then recompiling it.
So, if you are interested in developing interesting mods and Custom ROMs or if you feel that the existing ROM needs a refresh, then use this guide in order to learn how to decompile and recompile APK files.
For this guide you need the APKTool which is an application for reverse engineering Android apps. It can decode resources (decompile) and then rebuild them after making all the necessary modifications. The tool can be used to analyze apps and even add features, so use it with full confidence.
However, keep in mind that I am here to support you and even if this guide has been tested and I know for sure that it is functional, anything can happen if you make any mistake. I do not endorse any responsibility if you damage or brick your handset in one way or another, so it’s your decision to take.
If it’s too much for you, stop here; if not, setup ADB and Fastboot on your computer and carefully follow the steps below as they are given:
How to Decompile and Recompile APK Files with Ease:
- For the start, you have to download the Apktool files on your PC from here;
- Feel free to extract the Apktool files in the same folder where you have the adb tools;
- Open a command prompt in the ADB folder by holding Shift key and Right Click in the empty space in the folder.open-cmd-windows;
- Install the framework on your device. You can install the SystemUI.apk alone, but installing the framework-res.apk is also recommended in case of system apps, so type this command:
apktool if - Also install the SystemUI.apk using the command:
apktool if SystemUI.apk - In order to decompile the SystemUI.apk file, enter the following command to decompile the file:
apktool d - After the APK is decompiled you will see a folder in the ADB tools directory with the name of the decompiled apk. Inside the folder, you will get several folders and the Smali folder is one of them;
- This folder contains the processed Java files in the form of .smali files which are waiting to be edited;
- After making all the modifications that you want to the APK, it’s time to recompile the APK with the help of this command:
apktool b - The modifications recently applied might use much more system resources than they should, so use the Zipalign tool to avoid any problem;
- Take the Zipalign tool from here;
- Extract it in the very same folder where you have the recompiled APK;
- Now type the following command:
zipalign -v 4 - A new file created will appear in the folder under the SystemUI-new.apk name or whatever APK you modded. This is the final APK perfectly optimized with the help of this tool, so enjoy it!