[Utility][Tool]baksmali/smali

Search This thread

majdinj

Senior Member
Nov 25, 2006
980
3,438
AlAhsa
Yea this is saying I don't have java on my computer although I do and java works on my computer so all the text is red saying I need to install Java...Additionaly it won't create any folders? Where does it create them at? Thanks

Which java version you have?
I have JDK and JRE installed in my computer and it is fine..
 

majdinj

Senior Member
Nov 25, 2006
980
3,438
AlAhsa
New update online..

v1.57 @ 13/October/2013
- Added ability to push to preload partition in option 3.
- Added ability to perform hot reboot after pushing the modded file in option 3
- Update baksmali and smali codes to v2.0 (date 10/10/2013).
 
  • Like
Reactions: baran0119

majdinj

Senior Member
Nov 25, 2006
980
3,438
AlAhsa
New update online...

v1.58 @ 23/November/2013
- Added option to baksmali using .locals instead of .registers in option 1
- Clear reboot options after pushing your file to your device in option 3
- Update baksmali and smali codes to v2.0.2
 

vidwhal

Senior Member
Apr 19, 2008
936
2,694
Perth
Yea this is saying I don't have java on my computer although I do and java works on my computer so all the text is red saying I need to install Java...Additionaly it won't create any folders? Where does it create them at? Thanks

Looks like you need to have x64 Java installed as well as x32.
 

bajasur

Retired Forum Moderator
Sep 19, 2012
4,042
10,523
San Clemente
I had a problem running this on windows 8

I had to edit the bat and change some of the "/" to "\" for it to make the folders and dump properly
not sure if its just windows being picky or if you've accidentally used the wrong slash in places

edit:
that didn't quite fix it.
the %~dp0 trails a backslash so the error went from being:
"The system cannot find the file C:\Baksmali\/project/project1.apk_classout"
to:
"The system cannot find the file C:\Baksmali\\project\project1.apk_classout"

I am still having this problem on Windows 7.

Downloaded the latest tool and still is there for me.

Any advice on how to workaround this?
 

krchi

Senior Member
Dec 11, 2012
606
96
hi i get like an error saying windows cant fine the folder after i select option 1 then x then y and y and it pops out the windows cant find that folder and i cant fine it either i tried looking for it but it didnt find it any help?
 

regentonne

Senior Member
Nov 19, 2013
140
5
try working on a directory with no space on its name.

ok... finally... BUT: your tip didn't work either... what did the trick (for me) was:
1. start in "administrator mode"
2. press any button
3. press "8 clean folders"
4. press "5 clean all folders"
surprise... baksmali build the non existing folders after cleaning Oo
 
  • Like
Reactions: iwilltouchthesky

Pankaj Rai

Senior Member
Oct 17, 2013
527
371
mumbai
www.obeyandroid.com
great work
Baksmali / Smali Manager​

backsmalicopy.jpg



What is Baksmali / Smali?
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 equivalents of "assembler" and "disassembler" respectively.

Why we need it?
Android apk and jar files will include java classes to execute certain functionality. With baksmali, you will be able to disassemble the java classes into editable form (smalis) so you can do your editing and modding involving java script. Once you done changing, you need to assemble all classes to a readable form for android, i.e, classes.dex and here comes the role of assembler (Smali).

Since we have apk manager, do we still need this tool?
Yes and No!!! Because some apk managers even if they do support jar files but once they decompile smalis, they will remove some lines (.line, .parameter, ...etc) which are in my opinion are useful to locate some codes. So the choice is yours.

What does this tool do?
Simply it baksmali classes.dex of android apk and jar files into editable form (smalis) to do your changes; then assemble it back (smali).

Will it affect apk and jar original signature?
No, it will preserve original signature.

Got problem?
During assembling (smali), you may got error message. You can check log file to locate what is wrong that make the manager stop assembling the file or post the log file for developers to look into it.

What are the steps to work with this manager?
Run Baksmali_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, push it to your device by option #3 if it was system apk or jar; and if it was non system apk file, install it by option #4.

If baksmali and smali code are outdated, what to do?
Just visit codes owner page, and download the latest smali and baksmali code versions and put them in "tools" folder (make sure to rename them to baksmali and smali without version number)

Future development?
Feel free to report any bugs or suggestion to improve upcoming releases :good:

Download
- Baksmali-Manager_v1.58 @ 23/November/2013 (The newest)
- Baksmali-Manager_v1.57 @ 13/October/2013
- Baksmali-Manager_v1.56 @ 8/October/2013
- Baksmali-Manager_v1.55 @ 5/October/2013
- Baksmali-Manager_v1.5 @ 29/June/2013
- Baksmali-Manager_v1.4 @ 23/June/2013
- Baksmali-Manager_v1.3 @ 19/June/2013
- Baksmali-Manager_v1.2 @ 11/June/2013
- Baksmali-Manager_v1.1 @ 7/June/2013
- Baksmali-Manager_v1.0 @ 6/June/2013

Change-log:
Code:
[B][U]v1.58 @ 23/November/2013[/U][/B]
- Added option to baksmali using .locals instead of .registers in option 1
- Clear reboot options after pushing your file to your device in option 3
- Update baksmali and smali codes to v2.0.2

[B][U]v1.57 @ 13/October/2013[/U][/B]
- Added ability to push to preload partition in option 3.
- Added ability to perform hot reboot after pushing the modded file in option 3
- Update baksmali and smali codes to v2.0 (date 10/10/2013).

[B][U]v1.56 @ 8/October/2013:[/U][/B]
- Fixed some syntax for full compatibility with new WIN 8 cmd version (Thanks to [user=1789084]@c0pyright[/user] for testing).

[B][U]v1.55 @ 5/October/2013:[/U][/B]
- Update baksmali and smali codes to v2.0b6 (date 14/9/2013).
- Update adb, zipalign engine from android sdk 20130917.
- Corrected some typo errors.

[B][U]v1.5 @ 29/June/2013:[/U][/B]
- Fixed adb remount bug for some ROMs in push option.
- Baksmali argument is updated; now you can choose whether to baksmali with x argument (retain .line, .parameter, .prologue, and .local) or b argument (remove .line, .parameter, .prologue, and .local).

[B][U]v1.4 @ 23/June/2013 (v1.4):[/U][/B]
- Added Pull apk or jar From Android Device to the main menu.
- Added zipaligning process during Smali (better RAM management).
- Fixed apk installing process (added signing process step for installing apk process).
- Added direct link to this xda page in update option.
- More script polishing...

[B][U]v1.3 @ 19/June/2013 (v1.3):[/U][/B]
- Added adb push finished file to device system partition (for system files) "This option needs to have insecured boot image OR [URL="http://forum.xda-developers.com/showthread.php?t=1687590"]adbd insecure[/URL] installed on android device".
- Ability to choose whether to reboot device after pushing files to device.
- Added adb install finished apk (for non-system files).
- Adjustable Java heap memory size.
- Adjustable finished file compression level.
- Updated Smali and Baksmali codes (date 15/6/2013).


[B][U]v1.2 @ 11/June/2013 (v1.2):[/U][/B]
- Fixed bug of file path in Read Log option.
- Fixed number 10 file that was not shown in Set Current-file option.

[B][U]v1.1 @ 7/June/2013 (v1.1):[/U][/B]
- Deleting the folder and file in project and finish folder of same project name before baksmali or smali (no more overlapping :fingers-crossed:).
- Added Read log file functionality in the main menu.
- Ability to open classout folder after baksmali.
- Ability to open finish folder after smali.
- Ability to renamed finished modded file to its original name.
- Neat smali and compression processing (i.e, hidden processing :cool:).
- Fixed set Current-file option to visualize only apk and jar files.

[B][U]v1.0 @ 6/June/2013 (v1.0):[/U][/B]
- First release of Baksmali / smali manager


Special Thanks to XDA Portal Team For Featuring This Utility:
http://www.xda-developers.com/android/simplify-your-modifications-with-backsmali-smali-manager/
 

beeewell

Senior Member
Apr 25, 2012
258
88
Nexus 6
Google Pixel 3a
FYI

Thanks to everyone that contributed, developed, and maintained this tool. Just a heads up that using the latest version, the process SEEMED to work correctly, but in looking at the decompiled code, I got incorrect baksmali results.

A similar tool gave me the correct results, and that tool is located here: http://forum.xda-developers.com/attachment.php?attachmentid=2805934&d=1403124131

If anyone would like more info about this, please PM me.
 
  • Like
Reactions: Al Arsyadi

Al Arsyadi

Senior Member
Aug 14, 2014
79
24
@majdinj I can't smali my decompiled apk, always error. The error code does not write in log file. Please help me!

---------- Post added at 08:57 AM ---------- Previous post was at 08:50 AM ----------

Thanks to everyone that contributed, developed, and maintained this tool. Just a heads up that using the latest version, the process SEEMED to work correctly, but in looking at the decompiled code, I got incorrect baksmali results.

A similar tool gave me the correct results, and that tool is located here: http://forum.xda-developers.com/attachment.php?attachmentid=2805934&d=1403124131

If anyone would like more info about this, please PM me.

Please give me example code that incorect!
 

Top Liked Posts

  • There are no posts matching your filters.
  • 88
    - What is baksmali/smali?

    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 equivalents of "assembler" and "disassembler" respectively.


    - Author of the tool

    JesusFreke


    - Why we need it?

    Android apk and jar files will include java classes to execute certain functionality. With baksmali, you will be able to disassemble the java classes into editable form (smalis) so you can do your editing and modding involving java script. Once you done changing, you need to assemble all classes to a readable form for android, i.e, classes.dex and here comes the role of assembler (Smali).


    Since we have apk manager, do we still need this tool?

    Yes and No!!! Because some apk managers even if they do support jar files but once they decompile smalis, they will remove some lines (.line, .parameter, ...etc) which are in my opinion are useful to locate some codes. So the choice is yours.


    - What does this tool do?

    Simply it baksmali classes.dex of android apk and jar files into editable form (smalis) to do your changes; then assemble it back (smali).


    - Will it affect apk and jar original signature?

    No, it will preserve original signature.


    - Got problem?

    During assembling (smali), you may got error message. You can check log file to locate what is wrong that make the manager stop assembling the file or post the log file for developers to look into it.


    - What are the steps to work with this tool?

    Run Baksmali_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, push it to your device by option #3 if it was system apk or jar; and if it was non system apk file, install it by option #4.


    - Latest stable version

    Latest stable baksmali/smali version: 2.2.2 (30.10.2017)

    baksmali v. 2.2.2 - Download (bitbucket.org)

    smali v. 2.2.2 - Download (bitbucket.org)

    baksmali/smaly previous versions - Download (bitbucket.org)


    - Latest beta version

    Latest beta baksmali/smali version:


    - Changelog

    baksmali/smali wiki and changelog (github)


    - Where can I download latest source code?

    You can visit

    baksmali/smali source page (github)

    and you can download the latest smali and baksmali code versions.


    - Special Thanks to XDA Portal Team

    Special thanks to XDA Portal Team for featuring this utility

    XDA Portal Team

    ..
    3
    @ 29/June/2013 (v1.5-FINAL):
    - Fixed adb remount bug for some ROMs in push option.
    - Baksmali argument is updated; now you can choose whether to baksmali with x argument (retain .line, .parameter, .prologue, and .local) or b argument (remove .line, .parameter, .prologue, and .local).
    2
    I think the authers are these guys ([email protected], [email protected], JesusFr.. @gmail.com) from project page.. aren't they??? if so I will update OP

    Yes, thats the same person. I'd just put JesusFreke, as thats his username.
    2
    Version 1.1 is online
    2
    Version 1.3 is online

    Change log:
    - Added adb push finished file to device system partition (for system files).
    - Ability to choose whether to reboot device after pushing files to device.
    - Added adb install finished apk (for non-system files).
    - Adjustable Java heap memory size.
    - Adjustable finished file compression level.
    - Updated Smali and Backsmali codes (date 15/6/2013).
Our Apps
Get our official app!
The best way to access XDA on your phone
Nav Gestures
Add swipe gestures to any Android
One Handed Mode
Eases uses one hand with your phone