Getting source code from APK

Before proceeding towards explaining how to get source code from APK, we want to clarify that it is for educational purpose only.
APK file contains all the compiled java source in classes.dex file along with many other supportive files. There are some tools available which can be used to get the source code similar to the original source code. These tools are

  1. dex2jar (Download), and
  2. Java Decompiler (Download)

dex2jar comes in an archive which contains executable files, i.e. executable in Linux and windows both. and Java Decompiler comes with separate installer for Windows, Linux and Mac. Here the steps for using them.

(adsbygoogle = window.adsbygoogle || []).push({});

For Windows:


  1. After downloading the dex2jar archive extract it in a directory, like
  2. Set the path of the location in Environmental Variable. It makes it easy to use thedex2jar.bat easy.
  3. Now open the command prompt, and navigate to the folder where you have the apk available.
  4. The command for converting apk to jar
    D:\pcsalt\apks>dex2jar AppName.apk
  5. This will generate the AppName.jar which can be decoded byjd-gui.

Java Decompiler

  1. Download and extract the jd-gui
  2. It contains a jd-gui.exe, double click it to open
  3. You can open any .class, .jar file and view its source code.

For Linux (Ubuntu):


  1. The file is by default downloaded to the Downloads directory, i.e.
  2. Create a directory in ~/.installed_softs, i.e.
    $ mkdir -v ~/.installed_softs
  3. Extract it
    $ unzip ~/Downloads/ -d ~/.installed_softs
  4. Add an alternative in /usr/bin/ by the name dex2jar, so that it can be used from anywhere
    $ sudo update-alternatives --install "/usr/bin/dex2jar" "dex2jar" "/home//.installed_softs/dex2jar-" 1
  5. If you apk is available in /home/<username>/apk then give following command
    $ dex2jar ~/apk/AppName.apk
  6. This will create a file AppName-dex2jar.jar in the present working directory.

Java Decompiler

  1. Download and extract thejd-gui using the Archive manager.
  2. Double click on jd-gui to start.
  3. Browse any jar, class, zip, log or txt file.