28

The Android java code is compiled into Dalvik byte code, which is quite readable. I wonder, is it possible in theory and in practice to write a decompilation software for Dalvik byte code?

35

It's not only possible but has been done already, and not just once. Here's three I know about, and there may be more.

  1. Kivlad by Cody Brocious

    http://www.matasano.com/research/kivlad/

  2. DAD by Zost (Androguard project):

    http://code.google.com/p/androguard/wiki/Decompiler

  3. JEB by Nicolas Falliere (commercial)

    http://www.android-decompiler.com/

Then there are all the Java decompilers that can be used after using dex2jar or Dare on the Dalvik binary.

  • 2
    In theory all Java decompilers work as well as Dalvik class files can be transformed (back) into Java class files. In addition to the links above, you might want to look at Soot which recently added Dalvik support. – user209 Mar 20 '13 at 17:20
6

I think it should be possible even with current Java decompilers, by patching their code. They have at least one big difference - while JVM is stack-based, Dalvik is register-based. This difference could be handled with not so much code. Second difference - bytecode format. So you need use code, which is able to disassemble Dalvik bytecode format.

4

Don't forget http://dexter.dexlabs.org/ - Dexter is a static android application analysis tool.

2

jadx has both CLI and GUI, and it's open source.

1

Another tool is Bytecode Viewer:

https://github.com/Konloch/bytecode-viewer

Bytecode Viewer is an Advanced Lightweight Java Bytecode Viewer, GUI Java Decompiler, GUI Bytecode Editor, GUI Smali, GUI Baksmali, GUI APK Editor, GUI Dex Editor, GUI APK Decompiler, GUI DEX Decompiler, GUI Procyon Java Decompiler, GUI Krakatau, GUI CFR Java Decompiler, GUI FernFlower Java Decompiler, GUI DEX2Jar, GUI Jar2DEX, GUI Jar-Jar, Hex Viewer, Code Searcher, Debugger and more. It's written completely in Java, and it's open sourced. It's currently being maintained and developed by Konloch.

  • An example of usage would be more than welcome ! :-) – perror Feb 23 '15 at 10:05
0

In addition to the software listed by Igor, there are also tools like apktool that can be used to decompile code : it transforms dalvik bytecode to smali, a language specific to the dalvik virtual machine (see instructions/opcodes here for example).

You can also edit resources in the application, and build the application back (but it will break the original signature as you will have to re-sign it with your own key)

  • 4
    Sorry but what you're describing is disassembly, not decompilation. Smali is just a way to represent Dalvik bytecode, it's not a high level language like Java. – Igor Skochinsky Apr 10 '13 at 2:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.