Flexibility and customizability are the main things a Smartphone owner always wants. If you’re not satisfied with a segment in your Smartphone, you’re not required to mourn about it, you just need to know how to change it. However, you will not get this opportunity on any proprietary OS like IOS or Windows, this is possible in open source operating systems.

Open Source, the name itself says that it is open to everyone and anyone who is capable of handling it. Android is one such Open Source OS and is the most popular OS among the smartphones. It gives the flexibility to change the parts of OS that doesn’t impress you. Even you can change the look and feel of the apps on Android.

Android System apps can be modded & themed which can be used in making Custom ROMs. So if you’re interested in developing mods and Custom ROMs or if you want to do some simple modifications to the existing rom, you should know how to decompile and recompile APK files. Decompiling an APK allows you to modify the look and functionality of the app, so you can change the app according to your requirement. Once you’ve modded it, you should recompile it and optimize it to make efficient use of your Smartphone’s resources.

Today we will show how to decompile and recompile APK Files and then optimizing it in a simple way. Follow the guide carefully to decompile and recompile APK files to make themes and much more.


This Guide involves a lot of advanced stuff. Be extra cautious while you follow this guide, otherwise, you might end up with a bricked device. You alone are responsible for any consequences that might occur during the process. We shall not be held responsible for any damage to your device.



  1. Download the ADB files and extract them to a folder on your PC. Avoid extracting them on Desktop, because the black spaces in the username might pop some errors during the decompiling and recompiling.
  2. Download and extract the Apktool files in the same folder where you extracted the adb tools.
  3. We are taking SystemUI.apk as the test apk to decompile and recompile, you can take any apk you want to mod. So you will have similar files:
  4. Now 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
  5. Now you need to 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. Type the following command to install:
    apktool if <app-name.apk>

    In this case:

    apktool if framework-res.apk

    You will get the output similar to this:

  6. Now similarly install the SystemUI.apk using the command:
    apktool if SystemUI.apk
  7. Now we are ready to decompile the SystemUI.apk file. Type the following command to decompile the file:
    apktool d <apk-name.apk>

    In this Case:

    apktool d SystemUI.apk

    You will see a lot of activity on your command screen, the output should be similar to this:

  8. As you can see that the decompiling process takes resource table from the framework we installed in the previous steps. After the APK is decompiled you will see a folder in the ADB tools directory itself with the name of the decompiled apk. Inside the folder, you will get the folders similar this:
  9. These folders are more or less similar to an APK file. The res folder contains all the media files including images, ringtones and many more. It also contains the front end XML files which can be used to alter the look and feel of the app you’ve decompiled.
  10. The Smali folder is the tricky part, it contains the processed Java files in the form of .smali files. This folder only appears if the APK is deodexed, otherwise, these files are compressed in a single file with an extension .odex which will be found outside the APK. So you won’t get the Smali files unless the APK is deodexed.
  11. The Smali files are responsible for the functionality of the app, and handling them would create direct impacts to the app. So be careful while editing these files as they might cause unexpected responses on your device.
  12. Start your tinkering and make the necessary modifications to the APK, once finished we can recompile the APK.
  13. To recompile the APK type the following command:
    apktool b <decompiled-folder-name>

    In this case:

    apktool b SystemUI

    You will get the similar output once you press enter after typing the command:

  14. Now you can find the recompiled APK in the dist folder in the decompiled APK directory (SystemUI\dist)
  15. Now the APK is built, but due to the modifications made, the APK might not be compact and uses much more system resources than it actually should. To avoid this, we will align the package using Zipalign tool.
  16. Download the Zipalign tool and extract it in the same folder where you have placed the recompiled APK. → Click Here To Download 
  17. Now type the following command to Zipalign the APK
    zipalign -v 4 <recompiled-apk.apk> <final-apk.apk>

    In this case:

    zipalign -v 4 SystemUI.apk SystemUI-final.apk

    Once you press enter, you will see a lot of lines scrolling up. Don’t worry, it is just aligning your app package. At the end you should see a success message like this:

  18. Now you will see a new file created in the folder with the name SystemUI-new.apk (or whatever APK you modded) This is the final APK which is optimized using the Zipalign tool.
  19. You can flash this modded app in any possible way, you are comfortable with.

That’s it, you have now decompiled an APK, then modded it, recompiled the modded APK and finally you have optimized its performance using the Zipalign tool.

Lot of things to learn in a single tutorial, right? Leave your feedback in the comments section below.


  1. Showing error

    E:New foldermfastboot-v2>apktool if framework-res.apk
    Exception in thread “main” brut.androlib.AndrolibException: Could not decode ars
    c file
    at brut.androlib.res.decoder.ARSCDecoder.decode(Unknown Source)
    at brut.androlib.res.decoder.ARSCDecoder.decode(Unknown Source)
    at brut.androlib.res.AndrolibResources.installFramework(Unknown Source)
    at brut.androlib.Androlib.installFramework(Unknown Source)
    at brut.apktool.Main.cmdInstallFramework(Unknown Source)
    at brut.apktool.Main.main(Unknown Source)
    Caused by: java.io.IOException: Expected: 0x001c0001, got: 0x00000000
    at brut.util.ExtDataInput.skipCheckInt(Unknown Source)
    at brut.androlib.res.decoder.StringBlock.read(Unknown Source)
    at brut.androlib.res.decoder.ARSCDecoder.readPackage(Unknown Source)
    at brut.androlib.res.decoder.ARSCDecoder.readTable(Unknown Source)
    … 6 more

    E:New foldermfastboot-v2>

This site uses Akismet to reduce spam. Learn how your comment data is processed.