Friday, July 18, 2014

Posted by Anmol Sharma
APK or Android Package File is a file format used to install applications on an android phone. Extended form of .apk is ZIP format.

Following steps will retrieve Java & XML/HTML source code from an apk file:

Step 1

Change the extension of apk file to .zip and then extract the zip file to a new folder. Copy the classes.dex file and follow next step.

Step 2

Download dex2jar. Extract dex2jar in a folder and paste the classes.dex file into it. Now open the cmd, change path to dex2jar folder and execute the following command “dex2jar classes.dex”. This will create a new file called “classes.dex.dex2jar”.

Step 3

Download java decompiler. Open the jd-gui and open “classes.dex.dex2jar” file created during step 2. Click on file & click ‘save all sources’ in jd-gui; this will create a new folder with java source files. Next step will retrieve the XML files.

Step 4

Download apktool, apktool install window & framework-res.apk. Put all these files in a new folder with the apk file you need to decode. Open the cmd, change path to current folder and execute following two commands back to back -

apktool if framework-res.apk

apktool d "myapp".apk  (myapp = name of apk you want to decode)

A folder will be created containing XML files in the current folder .Merge folders created in step 2 & 5 and you will have both set of java & xml source files for that particular apk.

This method may not work for obfuscated/encrypted apks.

Feel free to drop a message in comments section below in case of any query. Good luck!


0 comments:

Post a Comment