Follow the procedure given below, to retrieve source from an
apk file.
1. Start with renaming the extension of file from
.apk to .zip (e.g.: rename from filename BuyCokeAndroid.apk to filename BuyCokeAndroid.zip)
it automatically converted into zip file and then extract it. If you open extracted
file, you will able to see “classes.dex” file.
2. Convert “classes.dex” to “classes.jar”. To convert
into jar file use the tool “dex2jar”. Download on this link http://code.google.com/p/dex2jar/downloads/list
and then extract it in same folder where
the classes.dex file is located.
3. Now, open command prompt and reach to the folder
where the classes.dex file is located.
For e.g. c:\Users\v.nadeshan\apk
decompile\BuyCodeAndroid>
Windows:
- Then type the command “dex2jar classes.dex” next to above path. c:\Users\v.nadeshan\apk
decompile\ BuyCodeAndroid> dex2jar classes.dex and enter
Mac:
- Then type the command “sh dex2jar.sh classes.dex” next to above path. c:\Users\v.nadeshan\apk
decompile\ BuyCodeAndroid> dex2jar classes.dex and enter and press enter.
Output:
- You get classes.dex.dex2jar file in the same folder.
4. Now, download java decompiler from http://java.decompiler.free.fr/?q=jdgui
and double click on jd-gui.exe and java Decompiler window is displayed. Open
classes.dex.dex2jar file in Java Decompiler and then you can see the source
files in the jd-gui window. You can save the source files by selecting
File>Save All Sources option and you will get the source files as zip.
6.
Download framework-res.apk file and put it in
same folder where the .apk file is located i.e. BuyCokeAndroid folder.
7.
Now, open command prompt and Navigate to the
directory where your .apk file is located (c:\Users\v.nadeshan\apk
decompile\BuyCodeAndroid>)and type the following command
Command
1
Windows:
- Then type the command “apktool if framework-res.apk” next to above path. c:\Users\v.nadeshan\apk
decompile\ BuyCodeAndroid> apktool if framework-res.apk and enter
Mac:
- Then type the command “sh apktool if framework-res.apk” next to above path. c:\Users\v.nadeshan\apk
decompile\ BuyCodeAndroid> sh apktool if framework-res.apk and enter and
press enter.
Output:
- you get a file folder in that folder and now you can easily read xml files
also.
Command
2
Windows:
- Then type the command “apktool d “framework-res.apk”” next to above path. c:\Users\v.nadeshan\apk
decompile\ BuyCodeAndroid> apktool d “framework-res.apk” and enter.
Mac:
- Then type the command “sh apktool d “framework-res.apk” next to above path. c:\Users\v.nadeshan\apk
decompile\ BuyCodeAndroid> sh apktool d “framework-res.apk and enter and
press enter.
Output:
- you get a file folder in that folder (framework-res) and now you can easily
read AndroidManifest files also.
"Happy Testing"
Comments
Post a Comment