[HOW-TO] Decompile ICS and above apk and jar files MANUALLY
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.
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
- 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:
and rename them to:
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.
- 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)
- Open up terminal or cmd
- cd to your directory
- Type the following:
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.
java -jar baksmali.jar -o classout/ classes.dex
- Go into the classout folder and make your smali edits
- Compile your classout folder into new-classes.dex by typing this into terminal:
java -Xmx512M -jar smali.jar classout/ -o new-classes.dex
- Rename new-classes.dex to classes.dex
- Take your newly compiled classes.dex and put it into your ICS .apk or .jar using 7zip or Betterzip