Sometimes anyhow we lost our data due to some reasons then there is great trick to extract apk file and get the source code from that apk file. There are two tools you have to need for getting java source code from apk file.
These tools are listed following:
- Dex2jar
- Jd-GUI(Java Decompiles)
You can also download these softwares from following links:
- (dex2jar)
- (jd-gui)
There are some steps to getting source code from the apk file.
Step 1:
First make a new folder and put that .apk file (which you want to extract for getting the source code) into that folder. Now you have to change the name of that .apk file with extension .zip. Also change the file name for example supposesyour file name is file.apk and you changed that file1.apk.zip. For example file.apk changes with file1.apk.zip and save this file in that folder.
After that you have to extract this zip file withWinRAR. Write click on that zip file and extract here. Then new folder will be created after extract that folder. When you click on new folder (generated after extract files) then you are only able to see draw able data there is no source code. From this you can get classess.dex files etc.
Step 2:
After first step now you have to download software from this link and extract it in same folder. And extract dex2jar.zip file. And open the dex2jar file. When you open that folder you can see files and folder in it. Select all files and folder and copy. In your app folder (from which you want to fetch java source code) you have to paste all copied data in it.
Now open the command prompt. Go to left top of the window click file menu in that you have to click open command prompt. Then command prompt is open. After this you have to write in command prompt “dex2jar classes.dex” command and press enter. Then classes.dex2jar.jar is created in same folder.
Step 3:
Now you have to download java decompiler from given link . When download is completed put that downloaded zip file into same folder and extract that file. Open “jd-gui-0.3.5.windows” this folder. Now double click on jd-gui.exe and click on open classes.dex.dex2jar file. When you clicked jd-gui.exe file the new window will be open. That window is the java decompiler window. In this window you have to open classess.dex.dex2jar file.
When you click open button then you can see your java source files as shown in picture.
Here you get your java source code successfully. Hopefully this information is helpful to you
Thank you.
Disclosure: We might earn commission from qualifying purchases. The commission help keep the rest of my content free, so thank you!
Tariqur Rahman says
woo awesome tips.I need it very much.thanks you author.
Nancy says
Thanks alot Tariqur Rahman
Jonty says
I downloaded an apk file.
I extracted the source code from it by the methods provided on the net.
I want ot learn the coding of the app..
On extracting and importing into the adt it does not shows errors but when i upload the same app on the phone it crashes “unfortunatly the app stopped working”
I am a newbie and i want to learn the code and so if i get the correct code i will be learn it faster..
Is there any reason why the app doesnt start.
Is it because we cannot extract the code properly from the app??
Thanks..
I want to kwon how this app is coded
for that i want to check the source code files
Nancy says
Hi Jonty
i learnt it from my office. you can also learn from youtube.
Thanks