In this tutorial, we will learn how to convert android APK file into source code. Android .apk file is a compressed form of a file that contains Java classes (in .dex form), XML files and all necessary files.
First of all, you need to download the following files for java & XML source code:
- Dex2Jar Download (For JAVA Code)
- Java Decompiler Download (For JAVA Code)
- APK TOOL Download (For XML Code)
- APK Install Download (For XML Code)
Steps to Extract Source Code (Java)
- Extract all the above files.
- Download your .apk file and paste it on your desktop.
- Rename your application (.apk to .zip) i.e. (ex: webview.apk to webview.zip)
- Now extract the webview.zip file.
- Open the WebView Net folder, there you will find the classes.dex file.
- Copy the classes.dex file and paste it in Dex2jar folder.
- Now open the command prompt(Run -> Cmd -> Enter). There locate the cmd to your folder (ex: cd C:\Users\santosh\Desktop\Java tools\dex2jar-0.0.9.15)
- Type a command “dex2jar classes.dex” Then press Enter key.
- Automatically classes_dex2jar.jar file will be created.
- 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
Steps To Extract XML Files
- Create an XML folder on the desktop. In that folder paste Apk tool, Apk installs and android apk (webview.apk) in that folder. (See the screenshot below)
- Now open command prompt -> Locate your XML folder using the command “cd C:\Users\santosh\Desktop\XML tool” Then press Enter key.
- There write the command “apktool d webview.apk” Then press Enter key.
- (Note: You can replace webview with your application name)
- Once all the process is completed. A folder with your application name will be created containing all the XML files.
- 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. Please let us know if you have any queries.