Guide to decompiling Android App to source code: Difference between revisions
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
{{Android}} | |||
<google>ENGELSK</google> | <google>ENGELSK</google> | ||
==Howto: Extract APK into readable Java source code and XML files== | ==Howto: Extract APK into readable Java source code and XML files== |
Latest revision as of 12:58, 7 December 2016
<google>ENGELSK</google>
Howto: Extract APK into readable Java source code and XML files
Setup
- Install Apk Manager Plus on your Android device.
- Download APK-Multi-Tool and extract the files into a folder on your harddisk. There must be no spaces in the directory path.
- Install 'Java SE Development Kit 7'.
- Edit the environtment variable 'JAVA_HOME' to point to 'C:\Program Files\Java\jdk1.7.0_51' or wherever you installed the Java Development Kit.
- Run Setup.bat
- Select step 2. 'Installing Framework-Res'.
- Connect your phone to the PC via USB.
- 9. Pull Dependencies from Phone
- 10. Return to Main Menu
- Select step 3. 'Setup Directories'.
- Select step 2. 'Installing Framework-Res'.
- Download dex2jar and extract it to wherever you want it installed.
- Download JD-GUI and extract it to wherever you want it installed.
Note: If step 2. 'Installing Framework-Res' fails it mighe be caused by a bug in APK-Multi-Tool\other\apkinstall.bat. To fix it replace:
- (Y) with [Y]
- (N) with (N)
- (y) with [y]
- (y) with (y)
- and (%INPUT%) with [%INPUT%]
Decompile .APK file
- Start 'Apk Manager Plus' on your Android device and export an App to the SD card
- Copy the <app>.apk to APK-Multi-Tool\place-apk-here-for-modding
- Run Script.bat
- Select 9. Decompile apk
- Decompiled apk is now in APK-Multi-Tool\projects (as smali files)
- Run C:\<path to dex2jar>\d2j-dex2jar <app>.apk
- <app> is now in <app>_dex2jar.jar
- Run C:\<path to jd-gui<\jd-gui.exe
- Select File-Save All Sources to save sourcecode
Tools
Apk Manager Plus
Apk Manager Plus can backup .apk files from apps installed on your phone or tablet to the SD card.
Afterwards you can use the USB cable to transfer them to a PC.
APK-Multi-Tool
- APK-Multi-Tool contains
- android-apktool
- A tool for reengineering 3rd party, closed, binary Android apps. It can decode resources to nearly original form and rebuild them after making some modifications.
- smali / backsmali
- assembler/disassembler for Android's dex format
- and a lot of other tools, and has build a menu system around all the tools.
To download APK-Multi-Tool Tool (includes android-apktool):
or clone Git repository from here:
dex2jar
Use dex2jar to translate .dex to .jar file then use JD-GUI to open the .jar file and view the .class files in the project.
usage: C:\path\d2j-dex2jar [options] <file0> [file1 ... fileN]
JD-GUI
JD-GUI is a standalone graphical utility that displays Java source codes of “.class” files. You can browse the reconstructed source code with the JD-GUI for instant access to methods and fields.
Other interesting links
<google>ENGELSK</google>