Decompiling apk is a very easy task. But you need to know the right tool for decompiling an apk. Decompile apk help us to understand the context of an apk how they are built. It also helps us in the context of anti-malware analysis. It sometimes refers to as reverse engineering an app.

There are many several tools available for decompiling. So, I am going to show you two tools which are very effective and well known for reverse engineering apk files.

They are:

  1. apktool.
  2. dex2jar.

A Brief Introduction About Tools:

apktool:

apktool is very effective when comes to the point of decompiling layout, values, resources XML file. it is very easy to use.

dex2jar:

dex2jar will do a great job when comes to the point of decompiling dex(Dalvik executable) to a jar file. Then we can use jd-gui tool to actually visit the java code.

How To Use The Tools:

dex2jar:

First, you have to download the dex2jar tool.

After, downloading the dex2jar.zip file. you have to place it in a specific directory where you can easily navigate. Now, you have to unzip the dex2jar.zip file.you will get two other zip files. You also have to unzip both of the files.

You will get two directories:

1. dex2jar-2.0: Is for decompiling dex to a jar file.

2.jd-gui-windows-1.4.0: Is for visualizing the jar file.

To converting dex to a jar file. you have to copy the apk file inside the dex2jar-2.0 directory. Then, Open the Command Prompt.

Now, you have to copy the dex2jar-2.0 directory path and paste in the Command Prompt to navigate to the directory via Command Prompt Like below Images.

press Enter.

Then, You have to type the below Command and press Enter.

sh d2j-dex2jar.sh -f name_of_your_apk_file.apk

If you get any issue with sh Command this is because your system doesn’t support any Linux command. So, you have to configure your system to support the Linux commands.

In this tutorial, I show you how to run Linux command in windows machine. This is actually a makefile tutorial but you will get your pc run Linux command.

After pressing Enter you will see output like below image. Don’t worry about the Error.

Now, you have to go to the directory jd-gui-windows-1.4.0 and open the jd-gui.exe marked in red.

After opening the jd-gui.exe you will see like below image and then click file ‘marked as red color’ and then click the open file.

you will see like this below image.

Then, you have to navigate to the dex2jar-2.0 directory and then you will see a jar file which name matches with your apk file name. then, Simply open the file.

Now you will see the java class files. Simply open the class file you will see Java code. If you do this so far I think you are doing very good.

apktool:

First, you have to download the tool.

You have to place the apk_tool.zip file into a separate folder. Then, you have to unzip the file and you will get two files like below image.

apktool image

Now, you have to copy the folder path and make an Environment Variable. So, that we can call apktool from anywhere within our computer.

In the below images I try to show you how you can do that.

Copy the folder path.

apktool path

Then, open the advanced system settings.

system settings

Then, click the Environment variable.

environment variableyou have to paste your apk_tool folder path in “path”.

environment variable value

To do that you have to press the new button. then, simply paste the folder path and click ok.

environment variable value insertNow, we have to test the tool. so, you can choose any apk file you want. I am going to show how you can do that.

First, you have to locate your apk file which you want to decompile. Then you have to open the Command Prompt and simply paste the directory path where apk file exists preceding with CD command like below image.

After navigating to the apk file directory via Command Prompt. You have to write the below command.


apktool d name_your_apk.apk

Then you have to press Enter to start decompiling.

After pressing Enter you will see like below Image.

After finishing the decompiling process you will see a folder exactly name like you apk file which is your decompiling output marked as red.

 

If you have done so far, then I think you can decompile any apk you want. So, best of Luck. Remember don’t use these tools against any apk that you don’t have the right to use. 

LEAVE A REPLY

Please enter your comment!
Please enter your name here

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