How to decompile/compile using apktools
This guide is for Windows only and I tested it in Windows 7 (64 bit) but should work with any windows version.
There might be an easier way of doing all of this, but this is what I found works for me. I know there are several other tools out there that automate it for you, but I have not really used them too much except for when I needed to do troubleshooting, since it saves the log when it compiles.
I like doing it manually so I can understand what is going on exactly. Also I think the automation tools do not come with the right apktool.jar versions to decompile framework-res.
Download the these apktools that I gathered and put together apktools-ics - Minus , there are several files in there. Apktool 1.4.2, Apktool 1.4.3, apktool.bat, and aapt.exe
You do not need the sdk installed, but you will need to have Java runtime installed. I am using Java version "1.6.0_29", but I am sure you can just downloaded the latest java runtime.
First thing you want to do is make sure you keep backups of any apk files just in case.
What I do is create a folder to work in and call it for example:
1) Take the zip and unzip all 4 files to c:\apktools. You can call this folder whatever you want or put it anywhere, that is up to you.
2) You will need to pull the framework-res.apk from the rom you are working on. Copy it to c:\apktools.
3) Rename apktool.jar.1.4.2 to apktool.jar
4) Open a command window and make sure everything you do from now on is while you are in this folder c:\apktools
We now need to install the framework and type the following:
java -jar apktool.jar if framework-res.apk
You only need to do this once, unless you are working on a different Rom, then you will need to copy the framework-res.apk from that Rom and run the above command again.
5) We can now decompile framework-res with apktool (most important thing is to make sure we are using version 1.4.2 or will get errors)'
at the command prompt type:
the d option stands for decompile and you will now see a folder under c:\apktools\framework-res. Here is all the output and can make any changes you want, and then can recompile. I would test to make sure you can recompile before making a lot of changes though.
java -jar apktool.jar d framework-res.apk
6) We will now compile framework-res.apk and what is most important is we need to compile it with apktool version 1.4.3
So what I do at this point is rename apktool.jar to apktool.1.4.2, and then rename apktool.jar.1.4.3 to apktool.jar
now we compile by running the following make sure you are still in c:\apktools
It will take a few minutes and it should complete without any errors.
java -jar apktool.jar b framework-res
7) Once it is done compiling you will need to go to c:\apktools\framework-res\dist and you will now see your new framework-res.apk
If you get any errors about plurals when compiling it means you used the wrong version of apktool.jar
For any other apk including systemUI.apk, you can decompile and recompile with apktool.jar version 1.4.3. Basically you will have to keep renaming the apktool.jar if you doing a lot of building with framework-res, otherwise most of the time you can decompile/recompile all other apk files with 1.4.3
Just remember to copy any apk you want to decompile right into the root of c:\apktools, run the decompile command and it will create a folder of the output that has the same of the apk file.
Once you have your apk file built you will need to open it with 7zip, and copy out any files you changed to the original apk. If you only changed xml files, then you just need to copy the resources.arsc file and place it in the original apk file. The reason you need to do this is the siganture will change and you want to keep that intact.
Last edited by Ghosthunter; 02-04-2012 at 03:04 PM.
02-02-2012 01:07 PM
Thanks, appreciate the help
Sure thing let me know if it works for you
Absolutely, interesting you have to use an older version to decompile the framework, I finally got the APK-Multi tool to compile it last night, don't ask me how, because it threw a bunch of error's and I absently just typed 00 to quit and the next thing I know it's compiling, but the size of the "unsigned...." file was much smaller than the source Framework file & I figured it wasn't going to work ...
Originally Posted by Ghosthunter
Just finished reading your instructions, really clear and well done, thanks.
Bummed I'll have to wait till the weekend to test this out, but commitments gotta be met!
Thanks for the files, I've been having a lot of trouble recompiling anything with what I've got now so I'm going to download these and see if I can get it to work. Thanks again!
...sent from your local Nexus
PM with any Questions
GTalk available upon Request
Good info I always wanted to dive into this..thanx..
Careful Ray, it's rather addicting
quick note on the installing the framework command (as far as I've gotten so far)
I had to add the extension ".jar" to apktool in the command like to get it to work
"java -jar apktool.jar if framework-res.apk"
don't know if the issue was configuration on my Win7(64bit) laptop or syntax for the command, just thought I'd mention it
on to Step #2!
So the missing .jar extension is just a typo, I see the next command includes it. The rest of the instructions worked like a champ, I added the framework, de-compiled and re-compiled systemUI without any problems, now to actually edit some .xml and see if I can change the color on the notification dropdown.
Thanks so much for this, really made things so much easier!
This is SOOOOO FREEKIN COOL, I have changed the clock color in the status bar. I'm so jazzed, feel like a kid on Christmas morning.
Now on to the rest....