Skip to content Skip to sidebar Skip to footer

Convert .java File To .smali File

I reverse-engineered an Android application with APKTool and got .Smali files as source code output. I converted the .Smali files with an application to .Java files. I was able to

Solution 1:

You can compile the java classes using a normal java compiler, and then use Android's 'dx' utility to convert the compiled .class files to a dex file. And then run baksmali on the dex file to produce the smali files.

For example, let's say you have the following code in a java file named "HelloWorld.java":

publicclassHelloWorld {
    publicstaticvoidmain(String[] args) {
         System.out.println("Hello World!");
    }
}

To convert it to smali:

javac HelloWorld.java
dx --dex --output=classes.dex HelloWorld.class
baksmali d classes.dex

Solution 2:

Post a Comment for "Convert .java File To .smali File"