Sometimes anyhow we lost our data due to some reasons then there is a 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 as follows:
- Jd-GUI(Java Decompiles)
You can also download this software from following links:
There are some steps to getting the 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, suppose your 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 with WinRAR. Right-click on that zip file and extract here. The new folder will be created after extract that folder. When you click on the new folder (generated after extract files) then you are only able to see drawable data there is no source code. From this, you can get classes.dex files etc.
After first step now you have to download software from this link and extract it in the same folder. And extract the 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 the 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 the same folder.
Now you have to download java decompiler from given link. When the download is completed put that downloaded zip file into the 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 the jd-gui.exe file the new window will be open. That window is the java decompiler window. In this window, you have to open classes.dex.dex2jar file.
When you click the open button then you can see your java source files as shown in the picture.
Here you get your java source code successfully. Hopefully, this information is helpful to you
After all these steps, you can then go back to your android authority then recode the app to suit you need.