Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is Smali Code Android

People also ask

What is Smali in Android?

smali/baksmali is an assembler/disassembler for the dex format used by dalvik, Android's Java VM implementation. The syntax is loosely based on Jasmin's/dedexer's syntax, and supports the full functionality of the dex format (annotations, debug info, line info, etc.)

What does Smali mean?

Noun. smali m (genitive singular smala, nominative plural smalar) (obsolete, collective) livestock. herder, herdsman. (figuratively) someone who gathers people for an event, such as voting.

What is Dex and Smali?

dex file, which contains binary Dalvik bytecode. This is the format that the platform actually understands. However, it's not easy to read or modify binary code, so there are tools out there to convert to and from a human readable representation. The most common human readable format is known as Smali.

How do you analyze the Smali code?

Reverse Engineering Processsmali code can be obtained by 'baksmaling' Dalvik executable files (. dex). Fortunately, there are tools which automate the entire process. I recommend APK Studio, which I found to be very handy, especially since you can build, export and install the app directly from the IDE.


When you create an application code, the apk file contains a .dex file, which contains binary Dalvik bytecode. This is the format that the platform actually understands. However, it's not easy to read or modify binary code, so there are tools out there to convert to and from a human readable representation. The most common human readable format is known as Smali. This is essentially the same as the dissembler you mentioned.

For example, say you have Java code that does something like

int x = 42

Assuming this is the first variable, then the dex code for the method will most likely contain the hexadecimal sequence

13 00 2A 00

If you run baksmali on it, you'd get a text file containing the line

const/16 v0, 42

Which is obviously a lot more readable then the binary code. But the platform doesn't know anything about smali, it's just a tool to make it easier to work with the bytecode.

Dalvik and ART both take .dex files containing dalvik bytecode. It's completely transparent to the application developer, the only difference is what happens behind the scenes when the application is installed and run.