Wednesday, March 26, 2014

Steps for decoding .apk files

Step 1:

- Copy .apk file in your folder.
- Rename the extension of this .apk file to .zip (eg.: rename from filename.apk to and save it.
- There are assets, meta-inf, res, classes.dex files, etc.
At this stage you are able to see drawable but not xml and java files.

Step 2:

- Extract the zip file.
- Download dex2jar from this link and extract it to the same folder.
- Move the classes.dex file into the dex2jar folder.
- Now open command prompt and change directory to that folder.
- Then write dex2jar classes.dex and press enter. Now you get classes_dex2jar.jar file in the same folder.
- Then download java decompiler from and now double click on jd-gui and click on open file.
- Then open classes_dex2jar.jar file from that folder.
- Now you get class files and save all these class files (click on file then click "save all sources" in jd-gui) by src name.
At this stage you get java source but the xml files are still unreadable, so continue.

Step 3:

- Open another folder and put .apk file which you want to decode

- download apktool v1.x  and apktool install window (both can be downloaded at the same location) and put in the same folder

- download framework-res.apk file and put in the same folder (Not all apk file need framework-res.apk file)

- Open a command window

- Navigate to the root directory of APKtool and type the following command:  apktool if framework-res.apk

- apktool d "fname".apk ("fname" denotes filename which you want to decode)

now you get a file folder in that folder and now you can easily read xml files also.

Step 4:

It's not any step just copy contents of both folder(in this case both new folder)to the single one