Extracting the Source Code of Android Applications

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 decompress the APK just rename with a “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

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

Conclusion

Here you go! You should now have access to the java source code…

Notes

To compile dex2jar use the following steps:

$ ./gradlew 
$ cd dex-tools/build/distributions
$ unzip dex-tools-2.1-SNAPSHOT.zip

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Amine

Amine

9 Followers

Big fan of technology with a recent interest in finance following the rise of cryptocurrencies.