Monday, June 22, 2009

It's alive!

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

14 comments:

  1. 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!

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

    ReplyDelete
  3. I wonder if "make magic happen" means "remove copy protection"?

    Hmm.

    Now where is my copy of MacNosy?

    ReplyDelete
  4. “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....

    ReplyDelete
  5. Who said anything about making money?

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

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

    Thanks for everything.

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

    ReplyDelete
  9. 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 !

    ReplyDelete
  10. 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.

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

    thx

    ReplyDelete
  12. 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.

    ReplyDelete
  13. Err, methinks "make magic happen" could mean things like enable multi-touch in Google Maps.

    ReplyDelete

Note: Only a member of this blog may post a comment.