Jump to content

How Do You Edit framework-res.apk?


Recommended Posts

Guest HustlinDaily
Posted

I am hoping some of the brilliant themers in our Liquid community could share some of their knowledge with me.

I want to mod framework-res.apk from LCR 1.7.3 to add battery percentage to the status bar (too nooby for services.jar and prefer LCR 1.7.3 to all other ROMs and I have tested ALOT). I found all the pngs for a round battery and placed it into the drawable-hdpi file replacing the current battery images.

I have a few questions:

1) Do I have to edit anything else? Any of the xml files? And if so, how?

2) Is LCR 1.7.3 odexed? And if so, do I have to take any extra steps?

3) How do I repack the apk? I have read conflicting things on the net, some saying the apk has to be signed in a certain way or something.

4) How do I create an update.zip which will flash correctly?

Thanks in advance. I love LCR 1.7.3 (loud navigation, Dolby Mobile, great battery life, it is brilliant) but wish it had battery percentage in the battery on the notification bar, that would make it perfect for me! (especially the round one, that looks so badass)

Posted (edited)

You can use apktool to unpack/repack *.apk.

I guess the xml file is res/drawable/stat_sys_battery.xml, and pngs are res/drawable-hdpi/stat_sys_battery_*.png

Remember to sign the apk after repack.

Edited by azuwis
Posted

The apk file is simple a signed zip file. The easiest thing to do is extract the apk file somewhere(keeping original apk file), make your changes, then open up the original apk in something like winzip, then drag your new files into winzip. This method removes the step of having to resign the new apk.

Guest Delnar_Ersike
Posted
This method removes the step of having to resign the new apk.

It does not. In my experiences, changing any part of an apk by adding, changing, or removing files voids the signature on the apk. Of course, I don't know if the system checks for a signature on framework-res.apk...

Posted

hi men...

i have used apktools for decompile new froyo framework-res...

i've found a few bugs and i fixed them..... but i can't compile it again....

i've spent my last 8 hours on try that...

can you post a tutorial to re compile xml files?? i've ALWAYS bootloop with my tries... :P

Guest Apocangel
Posted (edited)

Ive already decoded the apk and modified the XML then built it back up, but when i push the apk back to my phone it displays COMPLETELY wrong icons.

(instead of batteries ii get moons and other stuff.

What did I do wrong?

Edited by Apocangel
Posted
Ive already decoded the apk and modified the XML then built it back up, but when i push the apk back to my phone it displays COMPLETELY wrong icons.

(instead of batteries ii get moons and other stuff.

What did I do wrong?

uhm mind sharing how you modified the xml?

TIA

Guest Apocangel
Posted
uhm mind sharing how you modified the xml?

TIA

I decompiled the apk using apktool.

Once decompiled everything is in code, so rewriting it is easy.

Posted
It does not. In my experiences, changing any part of an apk by adding, changing, or removing files voids the signature on the apk. Of course, I don't know if the system checks for a signature on framework-res.apk...

Hmm interesting, I have been doing this way for my phone and I have not needed to resign the apk file. I found reference to this method on another forum and it seems to work for me.

Posted
Hmm interesting, I have been doing this way for my phone and I have not needed to resign the apk file. I found reference to this method on another forum and it seems to work for me.

apks in /system are not required to be signed...

  • 2 weeks later...
Guest Edward.W
Posted

Also searching for theses kind of information, want to try to make a own theme.

Posted
apks in /system are not required to be signed...

I'm not sure you are correct, i just pulled my framework-res.apk and check it with jarsigner and got this:

$ jarsigner -verify framework-res.apk

jar verified.

  • 4 weeks later...
Posted
OK I DID IT, YEAH :P

Great that you have a working recompiled framework. Can you share it with us.

thanks

  • 7 months later...
Guest Apetronic
Posted
Ive already decoded the apk and modified the XML then built it back up, but when i push the apk back to my phone it displays COMPLETELY wrong icons.

(instead of batteries ii get moons and other stuff.

What did I do wrong?

i know that this is a old thread but couldnt resist answering... so here we go: =)

This problem has nothing to do with the actual signing, instead it has to do with the "zip-alignment".

check: http://developer.android.com/guide/develop...s/zipalign.html for more info.

The problem is that if you edit the apk the way you did and then push it back to the phone (without "re-aligning" the zip) the resources in that apk (icons and other binary objects) and will end up with the wrong alignment in the binary.

Simplified example for beginners:

you have 3 juggling-balls colored red, gren, blue. You place thoose balls, lined up, in front of you on the table in the order (red, Green, Blue).

A blind person enters the room, you tell him the order and the corresponding color for each position of the lined up balls.

Index: Color <-> position

1 = red

2 = green

3 = blue

You then tell him to hand you the "green" ball without telling him the position(position = 2). And he does so successfully by remembering the i "Color <-> position" Index.

The actual problem

After that you put the ball back in alignment with the others, but this time you shuffle the balls around without telling him. You repeat your request and tell him to hand you the green ball. Since you havent given him the new index he will hand d you the ball placed at the same position as previously (index = 2). But since you have shuffled the balls around that will end up with you getting handed a "random" colored ball ......... Sure ...... you get "a ball", that feels like a ball and acts like a ball .. but its has the wrong color for your purpose....

The blind man is your Android based OS.

The OS picks out the icon indexed (aligned/positioned) as the icon to display for "battery" in your apk.

But since you have shuffled all the resources (icons and stuff) around in that binary the icon indexed as "Battery"-icon will not correspond to the intended icon/binary-object.

Hope that clarified your problem =)

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.