How to extract source code of an apk using apktool

Jasjot Singh
4 min readJun 2, 2019

--

I am preferring to write a blog on this topic because I found it very confusing to understand during my learning and I don’t want that it remain confusing for the beginners.So in this article I will be using very simple language and very simple procedure of steps and illustrating each step with images.

So here I begin-

  1. Create a folder named apktool in any part of your system and put the apk extension file in that folder.

2.Download apktool from the website https://ibotpeaches.github.io/Apktool/

by clicking on dowload in the news section.Shift apktool also to the same folder.

Now the apktool folder should look like -

3.Download JD-GUI through the website

Add JD-GUI also to the apktool folder

4.Finally download dex2jar from the website

It will be in zip file.Extract it and keep the extracted file in same folder.

5.Now open properties of This PC and go to advanced system settings.

The next step is to go to environment variables

Go to system variables.Click on path and then click on edit.

Add the path of newly created apktool folder-

Click ok and move to next step.

6.Now it is all set to get the source code.Open command prompt in case of windows and terminal in mac at the location of apktool folder.Type this command *apktool.jar d (name of file with.apk extension).apk*

A new folder will be formed as shown-

Folder will contain everything except the java folder.Now we will extract java folder in next step.

7.Copy apk file to dex2jar folder

Run command prompt in that location and type this command *d2j-dex2jar (name of file with.apk extension).apk*

A jar type file is created in that location.

8.Go Back to apktool folder and open jd-gui

Press ctrl+o and then select the jar type file formed in the step 7.

9.Expand com folder and then expand Package name folder you will get all the java files.

10.To open Manifest file and resources just open them in android studio.

In this manner we can extract source code in just 10 simple steps.

Can think of someone right now who should read this? The ‘Share’ button is all yours.

--

--

Jasjot Singh

Student at IIT Delhi. I am an Android Developer,Open Source Contributor.