This batch file decompiles an apk to its corresponding java sources. People who are looking forward to do a code review on an android app who’s source code is not readily available can utilize this bat. This batch runs various free tools available on the internet in a sequence to obtain the java source files.
This is not made to encourage piracy/plagiarism in any case.
1. Extract batch file and lib folder to C:\apk2java\ (or any folder that doesnt have space in its path)
2. Backup the target app’s apk from phone to PC via ASTRO Browser (check this post for details)
3. Keep the target apk in the root folder where batch file is present
4. Run ‘apk2java.bat target.apk’ in cmd
5. Result : java and resource files available in ‘src’
Note: This batch just automates the sequence in which various tools are initiated and does not handle any error events. You will have to go through the cmd verbose to figure out the problem.
Note 2: ‘lib’ folder contains apk-tool files (apk-tool.jar, aapt.exe), jad.exe, 7zip (7za.exe), dex2jar files (all other jars). If required, update each of those tools by replacing it with latest copy from links mentioned below.
- Windows (but can be ported to *NIX)
- JRE 1.6 (Java Runtime Environment)
Tools in lib
- Dex2jar – Converts Android dex format to jar (link)
- JAD – Java Decompiler CLI (link)
- 7Zip – Unarchival (link)
- apk-tool – Extracts resources from apk (link)
- aapt – Android Asset Packaging Tool (link)
- aapt commands (link)