10

I'm working with baksmali/smali tools. But sometimes I need to compile .java class to .smali file. So I've to first compile it with Eclipse and second disassemble the .APK to a set of .smali files.

Is it possible to directly compile .java into .smali with one single tool?

I couldn't find a solution myself...

JesusFreke
  • 19,784
  • 5
  • 65
  • 68
OGP
  • 950
  • 2
  • 11
  • 26

1 Answers1

12

"javac" or similar program can be used to convert the source code to .class.

Android's "dx" is used to convert .class to Dalvik .dex.

The result of that can be processed with the Smali tools. You should be able to invoke all of these directly from a script.

fadden
  • 51,356
  • 5
  • 116
  • 166
  • 1
    OK, thanks. I understand I have to use three tools. I hoped this is possible with a single one. – OGP Mar 29 '11 at 13:52
  • 11
    If you wrap a script around it, it will feel like one. :-) Seriously, when you compile a C program you have a pre-processor, a compiler, an assembler, a linker... you may only be typing "gcc foo.c", but there's a lot going on. – fadden Mar 29 '11 at 17:52