Tuesday, November 10, 2009

Convert Android DEX to Java

I'm playing with a great Android to Java converter named UnDX. You can find it at

http://www.illegalaccess.org/undx

it uses BCEL to convert the files. It's in beta, has some errors.

So, I decided to create my own converter using ASM. The idea is simple:

- Create a DEX reader extending ClassReader. Here call all the Visitor events to generate the java code.
- Use ASM to manipulate the java bytecode.
- Create a DEX ClassWriter. It must be exactly the same for java, but after generating all the bytearrays it must use dx command to create de DEX file.

The idea is simple, I had some tests and it works! I'm generating the java code and I can manipulate it.

I'll tell you later what happens with some big DEX files.

Cheers,

Lula

2 comments:

  1. Hi, I don't know if you still check this blog since it has no new entry since march, but could you give me more infos about this tool? I checked undx but your link is now broken, and the sourceforge page is empty. And I can't find your tool either.

    thanks!

    ReplyDelete
  2. Hi,

    sorry the delay, I work full time every day and have a family ;)

    The undx tool is hard to find, but if you google "undx.jar" you will find it.

    Good luck,

    Lula

    ReplyDelete