1 May 2015

Decompiling Android APK to java and XML files Step by Step (Part-1)

Here we will Learn how to decompile an apk file Softwares required are listed below:

Softwares Link Size
Desired APK
https://github.com/yatinkode/SoundDemo.git 2 Mb
apktool https://my.pcloud.com/publink/show?code=Hk2 30Mb
framework-res.apk https://www.androidfilehost.com/?fid=23212708291677144 10.4Mb
jdk1.7 http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html 138Mb
dex2jar.zip https://dex2jar.googlecode.com/files/dex2jar- 1.60Mb

Step 1 : Copy all the downloaded softwares in a folder. Create a New Folder in the same folder.
download software

Step 2 : Extract all the softwares from their zip to the same folder(decompiling).
extract all

Step 3 : Rename the apk (SoundDemo.apk) to SoundDemo.apk.rar. Remove SoundDemo.apk from the folder but don't delete it.
rename rar

Step 4 : Extract the rar file to a folder named SoundDemo
extract sounddemo

Step 5 : You will find following contents in SoundDemo folder.
in folder

Step 6 : Copy all the contents from SoundDemo to New Folder.
copy content

Step 7 : Here are the contents in dex2jar folder.
in dex2jar

Step 8 : Copy all these contents in New Folder. Remember now there are contents of SoundDemo and dex2jar folders in New Folder currently.
in newfolder

Step 9 : Open Command Prompt and go to location of New Folder by typing following 2 commands:
1) cd pathtoNewFolder 
2) dex2jar classes.dex
Replace pathtoNewFoder with actual path to New Folder from your computer.
path to

Step 10 : Now copy classesdex2jar.jar from New Folder to outside folder (decompiling folder).
classes dex2jar
from above

Step 11 : Bring the removed SoundDemo.apk back to our folder.
apk file

Step 12 : Run the .exe file found in jd-gui folder.
exe file

Step 13 : Drag classes.dex2jar.jar to java decompiler.
java decompiler

Step 14 : Click on File->Save All Sources.
in classes

Step 15 : Give name as classes_dex2jar.src.zip an save it in same folder.
make zip

Step 16 : Extract classes_dex2jar.src.zip to a folder classes_dex2jar.src in same folder.
make folder

Step 17 : Make a New Folder named Decompiled SoundDemo and copy contents in classes_dex2jar.src folder to Decompiled SoundDemo folder.
decompiled sounddemo
decompiled sounddemo

The java resources of SoundDemo are extracted. The xml resources will be extracted in the next post.

Stay Tuned with Made In Android

Previous Page Next Page Home

No comments:

Post a Comment