Android application package (APK) is the package file format used to distribute and install application software onto Google's Android operating system. There are a lot of reasons why you would like to decompile an APK, to learn how an application works, to increase the security and complexity of your code, to steal source code from applications ... i mean, to analyze it ... and others.
To decompile an APK file, in this article we are going to use jadx, the command line and GUI tool for produce Java source code from Android Dex and Apk files.
- You need obviously Java installed on your machine.
In no case shall we (Our Code World) or the developer of this application be liable for direct, indirect, special or other consequential damages resulting from the use of this application or from the application packages (APKs) decompiled with it. Use it at your own risk.
1. Download the jadx binaries
To get started with the decompilation of an APK file with jadx, you will need the binaries of this application that you can download through different sources namely Github and SourceForge:
This application is public and licensed under the Apache 2.0 License. The source code is available on Github and the binaries are available to download in the releases window here. Download always the latest version:
You can download the zip with the binaries of jadx from SourceForge here. Download always the latest version:
The download of the binaries from any of the previous sources, should be a zip file.
2. Extract zip content
Extract the content of the downloaded zip files into a folder of your preference, the content of the zip will be something like:
Of our interest is the bin folder that contains the bat files that allow us to use jadx either with the command line or the graphic user interface (GUI):
Execute the bat files with administrator rights, otherwise in some PCs jadx won't even start.
3. Using jadx to decompile an APK
You can use jadx from the command line or from an user graphical interface:
jadx is generally used with a graphical user interface, start the
jadx-gui.bat file (inside the
jadx-folder/bin folder) with administrator rights. As first you will get a window that allows you to choose the APK file that you want to decompile:
Pretty cool isn't ? You can save all the code within a folder if you click in the top menu, File and Save all.
With the command line
You can use jadx as a command line utility. Open a new command prompt with administrator rights and switch to the bin directory of jadx using the
cd command e.g:
Located in the bin directory where the jadx file is, you can execute the commands, for example to extract the code from an APK, you can use the following command:
REM the command has the following structure REM jadx -d [path-output-folder] [path-apk-or-dex-file] jadx -d C:\Users\sdkca\Desktop\source-code C:\Users\sdkca\Desktop\test-apks\ourcodeeditor-premium.apk
The execution of the previous command should extract all the source code in the
source-code folder in the desktop (note that the folder should already exist).
Happy decompilation !