[Q] How to modify and replace framework-res.apk

urkotheone

Member
Jul 4, 2011
36
2
0
Hello

I changed some png images with 7zip and copied back to system/framework/ but i got boot loop.
I would like to know how to modify and replace .apk that will work normal?

Thanks
 

ErwinP

Senior Member
Oct 6, 2010
602
864
0
31
How exactly did you replace the png's? Because the 'normal' proces of unzip-replace-rezip doesn't work.

The most easy way to changes png's:
1. Open framework-res.apk in 7-zip
2. Search for the files you want to change and copy them to your hard disk (do not unzip!!)
3. change the files. Make sure the name stays EXACT the same.
4. Open framework-res.apk and copy your new files in the desired place. By doing so, the original files will be replaced by your files. DO NOT USE ANY COMPRESSION (if asked select 'store').
5. Go into recovery, mount /system and replace the framework-res.apk by the new one. Reboot phone.

Take home message: never unzip :)

Hope it works now!


Erwin
 

ErwinP

Senior Member
Oct 6, 2010
602
864
0
31
i went to recovery and hit mount/system. But how can i replace it?

Thanks
You have to use adb to do is. I assume you know how to work with it. If not, you have to search for a little tutorial (can't link you right now because I'm using the xda app)

Put the new framework-res.apk in the same folder as adb.exe. Open the command prompt and brows to that same folder. Type in your command prompt:
Code:
adb shell mv system/framework/framework-res.apk system/framework/framework-res.old

adb push framework-res.apk system/framework

adb reboot
Due to the first command, you have a backup of your original framework-res.apk. To restore it, you have to boot in recovery, mount /system and again by the use of the command prompt, type:
Code:
adb shell rm system/framework/framework-res.apk

adb shell mv system/framework/framework-res.old system/framework/framework-res.apk

adb reboot
Erwin
 

urkotheone

Member
Jul 4, 2011
36
2
0
One more problem

When discharging it's working, but when I charge phone i don't get no battery icon. I believe it's because in original framework i had 100 png animations for charging and now i have only 20. Is there a way to fix this?
 

ErwinP

Senior Member
Oct 6, 2010
602
864
0
31
One more problem

When discharging it's working, but when I charge phone i don't get no battery icon. I believe it's because in original framework i had 100 png animations for charging and now i have only 20. Is there a way to fix this?
Then it is going to be much more complicated than that. Perhaps I can explain you in more detail tomorrow, but you will have to look up some things for yourself.

First, you should decompile the framework-res.apk first using apktool. You will notice that it almost looks like it just dezips your apk, but when you look closely, you will see now that you can open and read the xml files.
Second, you have to open res\drawable\stat_sys_battery.xml (or something similar, perhaps it depends on your ROM). Try to understand what is written and make some changes (it is really not that hard) so that your system shows only 20 different images, in stead of 100.
Third, you have to recompile your modified framework-res.apk. Then pull stat_sys_battery.xml out of "your" framework-res.apk into the original framework-res.apk, but again, without unzipping one of them. Do, of course, the same thing with your images.

I must admit, I've been busy with the battery icons myself. It was my plan to do something similar like you did, but I didn't do it yet. So all the things I've written above where the things I was planing to do, but I don't know if it will work, as I never tried it myself. So please, keep me/us informed ;-)

Good luck!

EDIT: I used this site to know how to decompile apk's.
 
Last edited:

crazy_dragonlady

Senior Member
Nov 20, 2011
136
85
0
SE PA
This is an old thread but I wanted to edit my systemUI.apk file with changing out a couple images... if I was to upload the file I edited (by just swapping out the images) to the UOT kitchen and use a mod, say the battery mod, would it make the file usable on my phone or would I get a bootloop or worse?

Basically what I did was opened up the SystemUI.apk file using 7zip and just swapped out the images I wanted (making sure I saved the original ones of course). I didn't unzip/zip anything.. I just opened it using 7zip and then closed it. It didn't ask me if I wanted to save anything though??

Sorry for the stupid question... but I thought it would be an idea as I want to use the UOT to make a mod to the theme I have anyways. :D
 

ErwinP

Senior Member
Oct 6, 2010
602
864
0
31
This is an old thread but I wanted to edit my systemUI.apk file with changing out a couple images... if I was to upload the file I edited (by just swapping out the images) to the UOT kitchen and use a mod, say the battery mod, would it make the file usable on my phone or would I get a bootloop or worse?

Basically what I did was opened up the SystemUI.apk file using 7zip and just swapped out the images I wanted (making sure I saved the original ones of course). I didn't unzip/zip anything.. I just opened it using 7zip and then closed it. It didn't ask me if I wanted to save anything though??

Sorry for the stupid question... but I thought it would be an idea as I want to use the UOT to make a mod to the theme I have anyways. :D
I don't know if I understand you fully, but I believe it would: only if the UOT changed the images that you have changed, you will not see the things you have changed.

What I did some time ago was upload my framework en systemui to the UOT, apply the battery mod and than change the battery images with my own. I did that just by opening the apk in WinRAR and adding my images, just like you did.

But if you only want to swapp some images, there is no need for uploading it to the UTO. Just continue as you did. Just make sure that you keep the original systemui.apk on your hdd. In case of a bootloop, you can easely revert.

Is that een answer to your question?

Erwin
 

crazy_dragonlady

Senior Member
Nov 20, 2011
136
85
0
SE PA
Yes, it does.. and thanks. I ended up following the instructions on another thread I found on here... don't remember exactly which one but it basically omitted uploading the files to the UOT. It was a guide on how to theme your phone... sorry but I didn't save the link. :(

thanks again!
CDL.
 

PlusAndroid

Senior Member
Mar 3, 2012
175
184
0
Hello

I changed some png images with 7zip and copied back to system/framework/ but i got boot loop.
I would like to know how to modify and replace .apk that will work normal?

Thanks
Same thing happened to me!
I Wiped Cache, Dalvik Cache, but nothing happened!
I had to flash 2.3.6 Stock ROM via Odin, to make my phone work!
 

ErwinP

Senior Member
Oct 6, 2010
602
864
0
31
I always work with Winrar, and in there you have the option for compression, which is selected at "medium compression" by default, and that causes bootloops.
So make sure that you don't compress your apk when adding your new png, or it will not work.

Erwin
 

swanster

Member
Nov 29, 2011
32
1
0
Balinese
I change my framework-res.apk from another rom. the problem is when I push long power button, my device going to BOOTANIMATION with out I choose shutdown, restart n etc.. what's wrong with my device?? :confused::confused:

sorry for my bad eng..
 

Scratch0805

Senior Member
Jun 18, 2011
2,151
1,315
0
Sheffield
The problem is its another roms framework so things are in different places and some things will be missing, put the framework-res.apk from your rom back and things should go back to normal, mind me asking what tweak or mod you are after using?

Sent from my HTC Wildfire using xda premium
 

swanster

Member
Nov 29, 2011
32
1
0
Balinese
first time I must say sorry, I know this not my device place on XDA, I use MB525.. but I see the same problem here..

I use Ms3ginger mod rom by walter, n I take framework-res.apk from 2.3.6_4.5.2-109 DHT25_themed MultiLanguage, I try to change battery sys-stat but I get bootloop..

once again sorry for my bad eng