[Tutorial] How to edit smali files


  1. nuttmeg

    nuttmeg Well-Known Member

    Posting what i found, Thanks goes to Yorzua over @ XDA: http://forum.xda-developers.com/showthread.php?t=1052731

    Thought this would make a semi good tut for anyone that wants to try and learn what smali is and how to create one.

    Tools needed :

    baksmalimanager.zip
    This is an example of a smali file changed (in this case, Global.Actions.smali located in android.policy.jar)

    _______________ Power Menu modded (smali changed) ______________

    [​IMG]

    Open my zip kit ( recomended in a Theming Folder for example with apkmanager and all files you would like to mod )

    What you get :
    • Baksmali
    • Baksmali ( executable Jar File )
    • Command.exe ( Shell file )
    • Notepad text with the two commands for decompile and compile already made for you ( just copy and paste into command.exe )
    • Smali
    • Smali ( executable Jar File )


    1. So the only thing you need is to place your apk in the smali kit folder


    2. To Decompile :

    Code:
    java -jar baksmali.jar -x yourfile -o classout
    (classout folder can be renamed to whatever you want, doesnt matter until you dont forget to change the name too in the second command)

    3. Make the modifications you want for smali files


    4. To Compile again :

    Code:
    java -Xmx512M -jar smali.jar classout -o classes.dex

    5. Copy and paste the file classes.dex into your apk _ you will overwrite the old one.


    Thanks to Rafalense


    1. If you follow my Tuto, you should always use apk manager 4.9 editing framework as you want to mod xml __ even better with XP rather than any windows else.
    2. Apk manager is not needed to decompile/recompile png's
    3. you just forget zip and use instead 7zip which allow you to directly drag any file you want to another zip without decompiling/compiling.
    4. Another rule is that you cant drag a xml from a zip to your hdd folder.
      you must decompile the apk first. if the xml is already modded, then you can drag it everywhere and re-drag it where you want.
    5. Never set framework-res as 1.apk
      apk manager does everything for you, you just need to decompile,
      set always level of compression to 0 in order to avoid issues during compilation work on the framework folder decompiled and just compile.
    6. If you proceed step by step, you should be fine.
    7. Note that systemUI.apk gives a lot of issues during decompilation
      Smali files are included in systemUI so better use my tool for smali's files
    8. Last one, i will prepare a tuto to take out the title in Power menu soon

    Advertisement
  2. Fuzzy13

    Fuzzy13 Well-Known Member

    This is awesome. Looking at the word smali makes me twitch though. Ish looks like some unidentified language.

    I would love if someone could port the ics power menu. Hint hint
    nuttmeg likes this.
  3. nuttmeg

    nuttmeg Well-Known Member


    I'd tinker with it around 3 am and got mad as hell and grab a cigar, you think messing with xml was a headache, this is horrible. ahahaha
  4. ShinySide

    ShinySide Disabled

    That would be an understatment. Ahaha
    nuttmeg likes this.
  5. nuttmeg

    nuttmeg Well-Known Member


    i had to watch myself for a minute there when i had posted that, that smali had me HOT. lmao
  6. ShinySide

    ShinySide Disabled

    I posted about samli once..Looked something like this when I hit post: **** ** ******* ****** *** ***** **** ******** ****** * *** * *****!!!!!!!!!!!!!!!!! :D

Share This Page