Baksmali/Smali Manager – Windows tool for reverse engineering Android APKs or framework
I believe many of us who are Android users won’t stay long with an OEM (Original Equipment Manufacturer, such as Samsung, Sony etc.) ROM. Eventually we will move on to custom ROMs that allow us to enjoy extra features and customization. There is also a certain group of people that are not content with the available ROMs and would like to dive into Android development themselves. To ease development, this calls for tools or programs to ease the development process. A very good tool which will be introduced here is Baksmali/Smali Manager.
Coded by XDA Recognized Themer majdinj, this tool runs on Windows. Baksmali/smali is quite essential in the process of reverse engineering Android APKs or framework files, as the decoded files will be your playground where you will tweak here and there, then comes the compiling process where you will start to pray hard that your modifications work and won’t send your device into a bootloop.
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.)
The names “smali” and “baksmali” are the Icelandic equivalents of “assembler” and “disassembler” respectively. Why Icelandic you ask? Because dalvik was named for an Icelandic fishing village.
In short, baksmali means you decode the compiled classes.dex in the APK or .jar file into human readable .smali files and smali means you recompile all the .smali files into classes.dex again. By using Baksmali/Smali Manager, it will save you from a lot of typing when executing commands to decode or compile.
Using the tool is very easy. As quoted from majdinj:
Run Backsmali_tool.bat file, this will create all needed folders in the first run..
1. Put android apk or jar file in “put-file-here” folder. If Current-file status is set to None, then either you need to set a file in option #3 or you forget putting valid file in “put-file-here” folder.
2. When Current-file status is set to your file, you can disassemble its classes.dex by option #1.
3. Classout folder with name of file project will be created in “project” folder; make your changes there.
4. If finished your changes, assemble classout folder by option #2.
5. If everything is OK, a new file will be created in “finish” folder with tag (Modded_) in its name, just rename it to its original name and push it to your device; don’t forget to fix permissions as well.
And since this tool depends on the smali assembler/disassembler by JesusFreke, what if the assembler/disassembler gets outdated? Well, you don’t have to worry as updating is plain simple:
Just visit codes owner page, and download the latest smali and backsmali code versions and put them in “tools” folder (make sure to rename them to baksmali and smali without version number)
So if you are a developer or hardcore Android fan, you should really get this tool from the XDA-Developers page, or just join in the discussion to report bugs or improve the tool.