Differences between apktool and baksmali
As far as I know, both apktool and baksmali can output smali code from .apk (.dex) files, and apktool uses dexlib2. They are both APK packaging / unpacking tools.
But still I don't understand what are the main differences between apktool and smali / baksmali. in temrs functionality with .dex files and advanced features?
PS: One of the differences I just figured out is that apktool can handle multiple dex files inside an apk, while baksmali cannot (at least not yet)
I tried to read the source code, but due to lack of experience, I could not understand the workflow of both tools. I would really appreciate it if anyone could suggest some readings or flowcharts etc.
Thank!
source to share
smali / baksmali is an assembler / disassembler pair for the dex format. Baksmali takes a dex file and creates a human readable assembly, and smali takes a human readable assembly and creates a dex file.
Apktool is more general for unpacking and repackaging apk. It actually uses smali / baksmali under the hood to compile / parse the dex file. It also unpacks binary resources and xml binaries back to standard text format, etc.
source to share
In short, it apktool
is for APK files, but baksmali
for DEX files.
An APK file is a zip archive with a specific structure. This application is for Android. This is what your smartphone or tablet downloads from the marketplace, usually on Google Play. The archive consists of manifest, resources, assertions / data files, native libraries and a DEX file .
The DEX file contains the application code . See https://source.android.com/devices/tech/dalvik/dex-format.html for details .
One more thing to say is that it apktool
is capable of extracting and packaging back the resource file. (I believe baksmali
it doesn't, check it out.)
source to share