# How To Get Source Code (JAVA & XML) From An Android APK File

**URL:** <https://onehack.st/t/how-to-get-source-code-java-xml-from-an-android-apk-file/54226>\
**Category:** Tutorials & Methods\
**Created:** [August 19, 2019, 2:21pm UTC](https://onehack.st/t/how-to-get-source-code-java-xml-from-an-android-apk-file/54226 "2019-08-19T14:21:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ajisafe\_Eniola](https://onehack.st/user_avatar/onehack.st/ajisafe_eniola/32/104727_2.png) [@Ajisafe\_Eniola](https://onehack.st/u/Ajisafe_Eniola)\
**Post date:** [August 19, 2019, 2:21pm UTC](https://onehack.st/t/how-to-get-source-code-java-xml-from-an-android-apk-file/54226/1 "2019-08-19T14:21:37Z")

</div>

The Android APK files are compressed files which consist of Java files, Xml file and some other necessary files. So first we need to extract them. The source code will be extracted in two files separately Java & Xml. The procedure for this shown below. This procedure is not so very easy. It is a tricky process, you will need some tools to perform this process. Follow the steps below after successfully installing that tools. You will also need an .apk file which you want to edit or extract.

Steps To Extract Source Code (JAVA & XML) From An Android APK File  
Pre -Requisites  
First of all you need to download the following things as stated under:  
Dex2Jar (For JAVA Code)  
Java Decompiler (For JAVA Code)  
APK TOOL  
APK Install

Steps to Extract Source Code (Java)  
Extract all the pre - requistics files.  
Download your apk file and paste it on your desktop.  
Rename your application (.apk to .zip) i.e. (ex: 1hackus.apk to 1hackus.zip)  
Now extract the 1hack.zip file.  
Extracting 1hack.zip file  
Extracting 1hack  
Open the 1hack folder, there you will find the classes.dex file.  
Classes.dex file  
Copy the classes.dex file and paste it in Dex2jar folder.  
Classes.dex file  
Now open the command prompt (Run → Cmd → Enter). There locate the cmd to your folder (ex: cd C:\Users\Shoeb Ahmad Fareed\Desktop\dex2jar-0.0.9.15)  
Enter a command “dex2jar classes.dex” → Enter  
Automatically classes\_dex2jar.jar file will be created.  
Classes.jar file  
Now to go to Jd-Gui folder (Dex Compiler) → Open jd-gui.exe  
Go to File → Open File and Locate the classes\_dex2jar.jar file from Dex2jar folder  
All the source will be displayed. Go to File → Save all sources  
By this you will get the source code of your application  
Jar to source code (DexCompiler)  
Steps To Extract XML Files  
Create a XML folder on desktop. In that folder paste Apk tool, Apk install and android apk (techiesnet.apk) in that folder. (See the screenshot below)  
Extracting XML files  
Now open command prompt → Locate your XML folder using the command “cd C:\Users\Shoeb Ahmad Fareed\Desktop\XML” → Enter  
There write the command “apktool d Techiesnet.apk” → Enter  
(Note: Replace Techiesnet with your application name)  
Once all the process is completed. A folder with your application name will be created containing All the XML files.  
cmd  
As now you have got both android source code (java) and (XML). Combine them, and you can easily import the folder in your Android Development Tools using your Android\_Manifest.xml file.  
We think, you enjoyed the topic.

---

<div class="post-metadata">

**Author:** ![Emmanuel\_Paul](https://onehack.st/user_avatar/onehack.st/emmanuel_paul/32/20918_2.png) [@Emmanuel\_Paul](https://onehack.st/u/Emmanuel_Paul)\
**Post date:** [August 19, 2019, 4:57pm UTC](https://onehack.st/t/how-to-get-source-code-java-xml-from-an-android-apk-file/54226/2 "2019-08-19T16:57:35Z")

</div>

thanks @TheSpecialOne  
[APK studio](https://github.com/vaibhavpandeyvpz/apkstudio) tries to combine the tools into a single setup which I think is a fast way to accomplish this
