With the number of ICS ROMs that are popping out, I imagine the majority of people are spending their time on ICS rather than Gingerbread or Froyo. With that in mind, here's a little guide on how to decompile ICS .apk and .jar files (such as the troublesome SystemUI.apk) with ease so that you can mod them to your heart's content. I assume this method will work for other versions of Android as well. Just so we understand each other, this just helps you decompile the classes.dex. If you want to decompile an entire app or jar file there are other guides for that.

NOTE: We will NOT be using ApkTool, Apk Manager, or StudioAndroid to do this. Mainly because I have had trouble in the past using those applications to decompile certain files. So, here is an ALL MANUAL way.

What you need:
  • Deodexed .apk/.jar file
  • smali.jar
  • baksmali.jar
  • 7zip or Betterzip (whether you are on Mac, Linux, or Windows)
  • terminal/cmd (depending on what you're running)

You can get the smali.jar and baksmali.jar files from here: http://code.google.com/p/smali/downloads/list

Download these files:
Code:
baksmali-1.3.3.jar
smali-1.3.3.jar
and rename them to:
Code:
baksmali.jar
smali.jar
Now that you have both files, place them somewhere you'll remember (like a folder on your Desktop). For the purposes of this guide, my files will be in .../Desktop/ICS

Ready? Okay, here we go.

  1. Open up your desired ICS .apk or .jar file with 7zip or Betterzip and extract the classes.dex and move it into the directory where you have baksmali.jar and smali.jar (For example, I move the classes.dex file to .../Desktop/ICS)
  2. Open up terminal or cmd
  3. cd to your directory
    Example:
    Code:
    cd .../Desktop/ICS
  4. Type the following:
    Code:
    java -jar baksmali.jar -o classout/ classes.dex
    This will decompile the classes.dex file and create a folder inside .../Desktop/ICS called classout where all of your smali files will be located.
  5. Go into the classout folder and make your smali edits
  6. Compile your classout folder into new-classes.dex by typing this into terminal:
    Code:
    java -Xmx512M -jar smali.jar classout/ -o new-classes.dex
  7. Rename new-classes.dex to classes.dex
  8. Take your newly compiled classes.dex and put it into your ICS .apk or .jar using 7zip or Betterzip
  9. Profit

Have fun

Post a Comment