Thursday, October 10, 2013

How to convert apk file to source android code

Step 1:
First take the .apk file (which you want to decode) and then create a new folder and copy that .apk file in to the new folder. Now rename this .apk file in the new folder with extension .zip (e.g.: rename from filename.apk to filename.apk.zip), if you are unable to rename the apk file in this way, then go to “Organize” option on the top of your window. Select “Folder and search options” select “view” then unselect the checkbox of “Hide extensions for known file types”.  So now the .apk file has become a .Zip file. Now extract that zip file. You can see the classes.dex files, drawable files etc..  in the extracted folder.
Step 2:
Now download dex2jar from this link http://code.google.com/p/dex2jar/ and extract it. Copy the entire content inside the dex2jar software (lib folder, d2j files etc….) and paste it in the previously extracted folder of .apk file (near classes.dex, assets folder). Now go back and press “Shift+Rightclick” on the extracted .apk folder. Select “Open command window here” or you can also open command prompt and move to this folder. Type dex2jar classes.dex and press enter. Now you get classes_dex2jar.jar in .apk extracted folder under classes.dex file. Close the command window. Now download java decompiler from http://java.decompiler.free.fr/?q=jdgui and now double click on jd-gui and click on File->Open File then open classes_dex2jar.jar  file from that folder. Now you get class file. Save all these class file (click on file then click "save all sources" in jd-gui) at your working area. Extract the classes_dex2jar.src.zip. At this stage you get source. But xml files are still unreadable.
Step 3:
Now open another new folder and put these files

1.       Put .apk file which you want to decode.
2.       Download apktool 2.1 for windows from this link http://code.google.com/p/android-apktool/downloads/detail?name=apktool-install-windows-2.1_r01-1.zip&can=2&q= and put in the same folder.
3.       Download framework-res.apk file from this link http://www.2shared.com/file/MIFn5Cuo/framework-res.html  and put in the same folder.
4.       Now copy the framework-res.apk file to apktool folder.
5.       Now press “Shift+Rightclick” on apktool folder and select “Open command window here”.
6.       Type apktool if framework-res.apk in command window and press enter.
7.       Now go back and copy the .apk file in to apktool folder.
8.       Type apktool d fname.apk ("fname" denotes filename which you want to decode) in command window.For e.g.:- apktool d “c:\newfolder\APKTool\sample.apk”(here sample is the apk file name) and press enter.
9.       You can see a folder created with the file name in the apktool folder (i.e source code).
10.   Delete the smali named folder inside source.
11.   Just copy contents of both folders (in this case both new folder) to the single one and now enjoy with source code.



For better understanding,you can go to the following youtube link:



VP: Tầng 3 , Tòa nhà E , 38 Nguyễn Huy Tự , Hai Bà Trưng , Hà Nội 
Email: sale@thaihoagroup.vn 

0 comments:

Post a Comment

Twitter Delicious Facebook Digg Stumbleupon Favorites More

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Powerade Coupons