[Utility][Tool]baksmali/smali

Search This thread

Al Arsyadi

Senior Member
Aug 14, 2014
79
24
Does anyone can guid me how to remove .param strings?

Code:
.method public showExpandButton(Z)V
    .locals 5
    .param p1    # Z

    const/4 v4, 0x0

    const/4 v3, 0x0

    if-eqz p1, :cond_27

Baksmali manager only remove .parameter strings, not .param.
I want to remove .param p1 # Z
@majdinj
 
  • Like
Reactions: ROBERT CM

Elmarigo

Senior Member
Jun 13, 2014
174
62
Hello!

I tried getting smali rom the SystemUI.apk of my phone.
I followed your instructions closely, but it wouldn't work:
-If I start the script as a normal user, than it just closes after the question regarding locals or registers. The log file has an error like "goto isn't allowed in this position" / syntax error.
-But if I start the script as administrator, then it gets one step further, where it says something like "There's no classes.dex in your apk".

What would be the right way?
And why does neither work?
Thank you!
 

mirhl

Senior Member
Oct 15, 2012
3,076
1,149
I updated all files to their latest version (but signapk), including way newer version of smali, that changed their commands syntax
 

Attachments

  • Baksmali-Manager_v2.00.7z
    4.6 MB · Views: 248
  • Like
Reactions: dynospectrum

davecotefilm

Senior Member
May 11, 2014
861
240
Vancouver
davecote.com
- 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.
.....
..

Hey there, I have a question regarding smali, and you're the only one in this area of expertise that seems to be an active xda member. I'm on here usually updating users with roms for my unique samsung s7-edge (unlocked snapdragon from hong kong), but it seems I need help, so I'll ask:

How can I edit this smali from always on display to get rid of the padding at the top of the screen? The AOD (always on display) displays a digital clock with background image (I've modded the image), and it displays centered with a hight of 400dip, which I want to change to 800dip, but at present that just starts the clock and image same quarter way down the screen, then goes off screen. So there must be something I'm missing in the smali, and I've editted the following to be 0x00 with no effect:
Code:
# static fields
.field private static final COVER_VERTICAL_RANGE:I = 0xdc

.field private static final HELP_VERTICAL_RANGE:I = 0x26c

.field private static final HORIZONTAL_RANGE:I = 0x64

.field private static final MOBILE_KEYBOARD_VERTICAL_RANGE:I = 0x28a

.field private static final VERTICAL_RANGE:I = 0x398

.field private static final mMoveDistance:I

I'll attach the smali files in a zip the one I'm looking at is /com/samsung/android/app/aodservice/controller/ui/AODUpdatePositionController$AODUpdatePositionType.smali, can you point me in the right direction to remove the top of screen padding?
 

Attachments

  • smali.zip
    2.3 MB · Views: 52

shagratt

Senior Member
Jun 21, 2006
249
11
I got this error trying to decompile:
----------------
Exception in thread "main" com.beust.jcommander.MissingCommandException: Expected a command, got -x
at com.beust.jcommander.JCommander.parseValues(JCommander.java:725)
at com.beust.jcommander.JCommander.parse(JCommander.java:304)
at com.beust.jcommander.JCommander.parse(JCommander.java:287)
at org.jf.baksmali.Main.main(Main.java:90)
------------
Any idea why? :/
 

levone1

Senior Member
Dec 28, 2014
3,767
1,452
- 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.

Special thanks to XDA Portal Team for featuring this utility

XDA Portal Team

..

Anybody know - Smali decoded instructions page says .art now supported, but when I attempt to deodex, I get same old message: "... Is not an odex, apk or oat file". Need a special command or something?
I'm using the newest version on the download page.
 

bovirus

Senior Member
Oct 7, 2007
2,154
787
Trying to compile udner Windows with JDK 1.8.0.231 I got these errors during tests

Task :baksmali:test

org.jf.baksmali.InstructionMethodItemTest > testInvalidReference FAILED
org.junit.ComparisonFailure at InstructionMethodItemTest.java:146

Task :smali:test FAILED

org.jf.smali.LexerTest > TypeAndIdentifierTest FAILED
java.lang.AssertionError at LexerTest.java:209

org.jf.smali.LexerTest > TypeAndIdentifierTest_api29 FAILED
java.lang.AssertionError at LexerTest.java:209

72 tests completed, 2 failed

Task :baksmali:test FAILED

32 tests completed, 1 failed

Task :dexlib2:compileTestJava
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
 

bovirus

Senior Member
Oct 7, 2007
2,154
787
Error on compiling on Windows 10 with JDK 1.8.0.241

org.jf.smali.LexerTest > TypeAndIdentifierTest FAILED
java.lang.AssertionError at LexerTest.java:209

org.jf.smali.LexerTest > TypeAndIdentifierTest_api29 FAILED
java.lang.AssertionError at LexerTest.java:209

72 tests completed, 2 failed

> Task :baksmali:test FAILED

org.jf.baksmali.InstructionMethodItemTest > testInvalidReference FAILED
org.junit.ComparisonFailure at InstructionMethodItemTest.java:146

32 tests completed, 1 failed

> Task :dexlib2:compileTestJava
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':smali:test'.

What's it?
 

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