• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Root [Tutorial] How to edit smali files

nuttmeg

Extreme Android User
Feb 9, 2011
7,329
2,525
Lone Star State
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) ______________

snap20110423190059.png


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
 
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


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
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones