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:
- Jd-GUI(Java Decompiles)
You can also download these softwares from following links:
There are some steps to getting source code from the apk file.
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.
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.
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
Disclosure: We might earn commission from qualifying purchases. The commission help keep the rest of my content free, so thank you!