Today, Android is an open source software stack for a wide range of mobile devices. Developers can easily obtain the source code from the Android Open Source Project and create their own applications. On the other hand, we can also reverse engineer the executable .apk file of an Android application and obtain the source code.
One of the ways of obtaining the underlying source code is by using the dex2jar library. Dex2jar is a lightweight API designed to read the Dalvik Executable (.dex/.odex) format.
The following steps are used to de-compile the apk!
Step 1: Obtain .apk file
You first need to obtain the .apk file of the application that you wish to decompile. For this purpose, third party applications like App Backup and Restore can be used. Rename the .apk file to a .zip file. Unzip the file to get the contents inside.
Step 2: Decompile .dex to .jar
Once the file is unzipped, one needs to decompile the classes.dex file. The dex file is the Dalvik executable file. The dex2jar tool is used to decode the .dex file to a .jar file as follows!
C:\softwares\dex2jar> dex2jar.bat classes.dex
Step 3: View source code
Finally, you need to open the decoded .jar file using a decompiler of your choice. I would recommend downloading JD-GUI from over here.
Reference: Decompiling an Android apk file
self proclaimed extraterrestrial fandroid, computer engineer, amateur gamer and die hard punk rock fan!