Android Tutorials


Saturday, 14 December 2013

Retrieve Source ode from .APK file

How to get source (java files) from .apk file?

As we now know that APK file is just a zip file containing all program resource file, we can now get java code from APK files with ease. Following are steps to get java code from APK files.

Step 1:

                     Make a new folder and put .APK file in it (which you want to decode). Now rename the extension of this .APK file to .zip (eg.: rename from filename.apk to and save it. Now you get classes.dex files, etc. At this stage you are able to see drawable but not xml and java files, so continue.

Step 2:

                   Now you download two tool(dex2jar and java decompiler ) from this link:


java decompiler:

Step 3: Extract Dex2jar and copy all file and into a same folder

Now open command prompt and go to the folder created in previous step and type the command "dex2jar classes.dex" and press enter.This will generate "classes.dex.dex2jar" file in the same folder.

Step 3:  
                   Now extract java decompiler and open it. From jd-gui window browse the generated "classes.dex.dex2jar" file in demofolder, this will give all the class files by src name.

Extract that zip file ( and you will get all java files of the application.
Above steps will generate java files but to get xml files perform following steps.

Above steps will generate java files but to get xml files perform following steps.

Step 3: 
          Getting xml files from APK

Now download two more tool for getting xml file:

Extract both files and place it in the same folder (for example "demoxmlfolder").
Place the .apk file in same folder (i.e demoxmlfolder)
Now open command prompt and goto  the directory where apktool is stored (here "demoxmlfolder") and type the command "apktool if framework-res.apk" 
Above command should result in "Framework installed ..."
Now in command prompt type the command "apktool d filename.apk" (where filename is name of apk file)
This will generate a folder of name filename in current directory (here demoxmlfolder) where all xml files would be stored in res\layout folder.


  1. I have done through all of this, and successful. But I still can't make it a project in my Android Studio. Can it be made?

  2. Great tutorial, it is noob-resistent