In this short tutorial, I will show you how to extract the code source of an android application. Starting with the name of the application we will be able to access the JAVA code source.
I assume that the used operating system is Linux (in my case Ubuntu 16.04).
STEP 1: Download the APK File
The first step is to download the application apk file. For this, we can use tools that we find online. One of them is https://apkcombo.com/fr-fr/apk-downloader/ . Otherwise feel free to ask Google: “download apk”.
STEP 2: Decompress the APK File
To open decompress the APK just rename it to give it the “zip” extension and then decompress it.
$ mv application.apk application.zip
$ unzip application.zip
STEP 3: Extract Class Files
Among the extracted files, you will find a “classes.dex” file. This the file that contains the binary code in class file. To decompress it, use the “dextojar” command available at: https://github.com/pxb1988/dex2jar
$ d2j-dex2jar.sh classes.dex
This will generate a jar file containing the class file.
STEP 4: Decompile Class Files
To decompile the class files we can use the jd-cli java decompiler available at https://github.com/kwart/jd-cmd
$ java -jar path-to/jd-cli.jar application.jar
$ jar xvf application.src.jar
Here you go! You should now have access to the java source code…
Feel free to comment or ask any questions and please don’t forget to clap.
To compile dex2jar use the following steps:
$ cd dex-tools/build/distributions
$ unzip dex-tools-2.1-SNAPSHOT.zip
Then use the d2j-jar2dex.sh found in the unzipped folder.