Learning How To Code In Smali by converting java2smali

I've been trying to learn smali for a while now, it seems to difficult so i plan on learning through converting little .java codes to .smali and studying the structure.. How can i convert a simple HelloWorld to .smali?

public class HelloWorld { public static void main (String args[]){ System.out.println("Hello World");

Upvotes: 0

Views: 1647

Answers (1)

JesusFreke
JesusFreke

Reputation: 20282

If you have HelloWorld.java:

public class HelloWorld {
    public static void main (String args[]){
        System.out.println("Hello World");
    }
}

Then you can do the following to compile it, convert it to a dex file, and finally disassemble it to smali code

javac HelloWorld.java
dx --dex --output=HelloWorld.dex HelloWorld.class
baksmali HelloWorld.dex -o HelloWorld

And then the smali code will be in HelloWorld/HelloWorld.smali

Upvotes: 2

Related Questions