It’s alive!

June 23, 2009

Alive I tell you, Alive! baksmali lives!

baksmali is the companion disassembler to smali, the dex assembler that I released recently. I’ve released a new version of smali as well, with a number of improvements/fixes. This is the v0.91 release of both tools.

As you might imagine, baksmali is able to disassemble a dex file into a set of text files, one for each class, containing the methods, field, annotations, debug info and dalvik bytecode for that class.

And then smali can munch on those text files and assemble them into shiny new classes.dex file, which you can repackage back into an apk/jar/zip file and throw on your android-based phone.

And most importantly, you can make magic happen when you make changes between the 2 steps.

Both tools are released as executable jar files. You can invoke them and get the usage information with

java -jar smali-0.91.jar
java -jar baksmali-0.91.jar

Unfortunately, the current incarnation of the tools are somewhat porcine. If you try to assemble/disassemble a large dex file and get an out-of-memory type error, try running with -Xmx512m, which increases the max java heap size to 512MB

java -Xmx512m -jar smali-0.91.jar [options]
java -Xmx512m -jar baksmali-0.91.jar [options]

The main project page for smali/baksmali is http://smali.googlecode.com

Tags:



14 Responses to “It’s alive!”

  1.   voxluna Says:

    I’m no programmer, but I understand enough to know what “make magic happen” means. Bravo, sir. You are one of the community’s most valuable… perhaps I should send another donation. Thanks for all your work!

    Reply

  2.   vitriolix Says:

    Very cool, if you digg it: http://digg.com/programming/Android_Dex_Assember_Disassembler_Released

    Reply

  3.   W Says:

    I wonder if “make magic happen” means “remove copy protection”?

    Hmm.

    Now where is my copy of MacNosy?

    Reply

  4.   emuboy Says:

    “make magic happen” means “know more”
    hacking for money is bad
    hacking for knowledge is good.make us different from other people.make us better….

    Reply

    jf Reply:

    Who said anything about making money?

    Reply

  5.   Danfuzz Says:

    In a word: awesome.

    Reply

    jf Reply:

    Thanks for the comment Dan! And many thanks for the great docs :)

    Reply

  6.   Stericson Says:

    Very impressive work, I only hope to meet such high standards of excellence and dedication to something one day.

    Thanks for everything.

    Reply

  7.   John Says:

    Outstanding work! Thank you so much for your contribution to the Android community.

    Reply

  8.   Waseem Says:

    I know your lovely new App. has already been put to work by some other programmers in porting HTC Music app. Im sure this is only the beggining……….I really dont think we can thank you enough for your creative work :)

    So in short….Gr8 work mate ! and Thanks !

    Reply

  9.   Stellarman Says:

    I would like to see someone apply this to HTC ExchangeSync. I would work on it myself, but I know I don’t have the programming “chops.”

    Great work, sir! You seem to ALWAYS be on the bleeding edge of development.

    Reply

  10.   PaNa Says:

    How i Can build an apk after dissasemble and editing it? I conly can launch with dalvikvm -cp ?

    thx

    Reply

    jf Reply:

    Using the “dalvikvm -cp” method is only for command-line java applications. For android applications, you need to replace the classes.dex file in the apk with the new one that smali outputs, and then resign the apk.

    Reply

  11.   Bo Says:

    Err, methinks “make magic happen” could mean things like enable multi-touch in Google Maps.

    Reply

Leave a Reply