[android] How to decompile an APK or DEX file on Android platform?

Is it possible to decompile an APK package or DEX file on Android platform? Are there any tools that can decompile an APK file?

This question is related to android disassembly decompiling malware-detection

The answer is


You need Three Tools to decompile an APK file.

  1. Dex2jar - Tools to work with android .dex and java .class files

  2. ApkTool - A tool for reverse engineering Android apk files

  3. JD-GUI - Java Decompiler is a tools to decompile and analyze Java 5 “byte code” and the later versions.

for more how-to-use-dextojar. Hope this will help You and all! :)


An APK is just in zip format. You can unzip it like any other .zip file.

You can decompile .dex files using the dexdump tool, which is provided in the Android SDK.

See https://stackoverflow.com/a/7750547/116938 for more dex info.


You can decompile an apk on Android device using this : https://play.google.com/store/apps/details?id=com.njlabs.showjava

For more info look here: http://forum.xda-developers.com/showthread.php?t=2601315

EDIT: 28-02-2015

For decompiling an apk you can use this tool: https://apkstudio.codeplex.com/license

If that doesnt help check this link


Online APK Decompiler
http://www.decompileandroid.com/
https://www.decompiler.com/
APK Decompiler App for Windows
http://forum.xda-developers.com/showthread.php?t=2493107

Update 2015/12/04
ClassyShark you can open APK/Zip/Class/Jar files and analyze their contents. https://github.com/google/android-classyshark

Update 2021/1/28
https://ibotpeaches.github.io/Apktool/
https://github.com/skylot/jadx


http://www.decompileandroid.com/

This website will decompile the code embedded in APK files and extract all the other assets in the file.


Also you can use Android Multitool. You can make minor changes in the app like hiding GUI elements or modifying small part of Logic and rebuild the apk. Its easy to use and decompile/recompile apk and jar files. Here is the Link you can checkout.

Cheers


You can also use the apktool: http://ibotpeaches.github.io/Apktool/ which will also give you the xml res files. Along with that you can also use the dex2jar system which will output the dex file in the apk to a jar file that can be opened with JD-GUI and exported to standard java files.


I have created a tool that combines dex2jar, jd-core and apktool: https://github.com/dirkvranckaert/AndroidDecompiler Just checkout the project locally and run the script as documented and you'll get all the resources and sources decompiled.


Examples related to android

Under what circumstances can I call findViewById with an Options Menu / Action Bar item? How to implement a simple scenario the OO way My eclipse won't open, i download the bundle pack it keeps saying error log getting " (1) no such column: _id10 " error java doesn't run if structure inside of onclick listener Cannot retrieve string(s) from preferences (settings) strange error in my Animation Drawable how to put image in a bundle and pass it to another activity FragmentActivity to Fragment A failure occurred while executing com.android.build.gradle.internal.tasks

Examples related to disassembly

How to decompile an APK or DEX file on Android platform? How to disassemble a binary executable in Linux to get the assembly code? How to disassemble a memory range with GDB?

Examples related to decompiling

How to decompile to java files intellij idea How to decompile an APK or DEX file on Android platform? How to change already compiled .class file without decompile? Reverse engineering from an APK file to a project Decompile an APK, modify it and then recompile it Is it possible to decompile a compiled .pyc file into a .py file? Extract source code from .jar file Is there a way to get the source code from an APK file? Is it possible to decompile an Android .apk file? How can I protect my .NET assemblies from decompilation?

Examples related to malware-detection

How to decompile an APK or DEX file on Android platform?