Today we will see how to decompile an Android Application (APK) to view its codes. Before decompiling we need to have couple of tools.
Below are the name and links of the tools:
- dex2jar- http://code.google.com/p/dex2jar/downloads/list
- jd-gui- http://code.google.com/p/innlab/downloads/detail?name=jd-gui-0.3.3.windows.zip&can=2&q=
- An android application I am using SMS backup application – http://appsapk.com/sms-backup/
So Lets start:
Download the application from given link and save it to your hard disk.
In order to completely understand the mechanism of the application, we need to obtain the source code of the application.
For Android application, this can be done by decompiling the Android Package (“.apk”) of the application. Android packages (“.apk” files) are actually simply ZIP files.
They contain the AndroidManifest.xml, classes.dex, resources.arsc, among other components. You can rename the extension and open it with a ZIP utility such as WinZip to view its contents.
Now change the application extension from .apk to .zip.
your application will look something like “SMS Backup.zip”. Extract it to a folder.
after extracting the files you’ll see number of files in that folder, for now we need file with extension .dex, this dex file will be converted into human readable .class files in java.
Now download the tool dex2jar converter from above link and copy the file “Classess.dex” into “dex2jar” folder.
Now open your command prompt and change the folder by using “cd” command and change the directory where you have your dex2jar converter.
In my case its “C:DownloadsAndroid toolsdex2jar-0.0.9.15”
After changing the directory use the following command ” d2j-dex2jar.bat classes.dex”.
Now after completion you will see a new file in same directory where you have your classes.dex file it is “.jar” file.
Now download “jd-gui” double click the application and browse the new generated jar file it will show you all the codes.
Here is the video Tutorial.
NOTE: you can only view the codes, you can not edit any thing in it.