Hello,
little background. i know my way around ROM installation (changing Kernels,modems, installing themes etc.) and read about how to use apk manager.
one of the things i still can't figure out, and seems to me like the next step is modifiyng themes.
i am currently using Perception 10.2, with stock theme. i really like the paragon basic theme + few more icons and items from phoneix and other themes.
i wend ahead and decompiled framework-res.apk from all the themes, and tried to copy over the images from the paragon drawable-hdpi folder to the same folder in Perception.
importent note, i know that there might be an issue with editing a .9.png file, but i assumed copying over a file that works in another rom is acceptable.
hope some of you are still with me.. here is the catch... tried to Compile the apk... and errors...
here is a parital log:
--------
|Sat 01/22/2011 -- 17:23:37.28|
--------------------------------------------------------------------------
java version "1.6.0_22"
Java(TM) SE Runtime Environment (build 1.6.0_22-b04)
Java HotSpot(TM) Client VM (build 17.1-b03, mixed mode, sharing)
'adb' is not recognized as an internal or external command,
operable program or batch file.
W: Could not find sources
I: Checking whether resources has changed...
I: Building resources...
libpng error: Read Error
ERROR: Failure processing PNG image Z:\F\kombinator work\android hack and hebrew\Developer\Tools\apk_manager_4.9\other\..\projects\framework-res.apk\res\drawable-hdpi\btn_zoom_down_disabled.9.png
libpng error: Read Error
ERROR: Failure processing PNG image Z:\F\kombinator work\android hack and hebrew\Developer\Tools\apk_manager_4.9\other\..\projects\framework-res.apk\res\drawable-hdpi\btn_zoom_down_disabled_focused.9.png
libpng error: Read Error
ERROR: Failure processing PNG image Z:\F\kombinator work\android hack and hebrew\Developer\Tools\apk_manager_4.9\other\..\projects\framework-res.apk\res\drawable-hdpi\btn_zoom_down_normal.9.png
libpng error: Read Error
ERROR: Failure processing PNG image Z:\F\kombinator work\android hack and hebrew\Developer\Tools\apk_manager_4.9\other\..\projects\framework-res.apk\res\drawable-hdpi\btn_zoom_down_pressed.9.png
libpng error: Read Error
ERROR: Failure processing PNG image Z:\F\kombinator work\android hack and hebrew\Developer\Tools\apk_manager_4.9\other\..\projects\framework-res.apk\res\drawable-hdpi\btn_zoom_down_selected.9.png
libpng error: Read Error
Click to expand...
Click to collapse
different error:
Z:\F\kombinator work\android hack and hebrew\Developer\Tools\apk_manager_4.9\other\..\projects\framework-res.apk\res\values\public.xml:3756: error: Public symbol drawable/zzzzz_tw_quickcontact_slider_grip_left declared here is not defined.
Z:\F\kombinator work\android hack and hebrew\Developer\Tools\apk_manager_4.9\other\..\projects\framework-res.apk\res\values\public.xml:3757: error: Public symbol drawable/zzzzz_tw_quickcontact_slider_grip_right declared here is not defined.
Click to expand...
Click to collapse
i hope someone can make sense out of this... i thought it would be a simple proccess, hope i did something wrong and it will be an easy fix...
Thank you so much for reading this far, your help will be appreciated!
Yossi
The problem you're having is with semi-transparent .9 files. The Android SDK png handler can't decompile them, so when you look at them in explorer they'll have a default image meaning they're corrupt.
The easiest way to deal with them is to not decompile and recompile.
PNG Only: With apk manager, take the original framework files from the ROM (or phone if stock) and drop them into place-apk-here-for-modding, then take the themed frameworks, rename them (something like framework-resParagon.apk) and drop those into place-apk-here-for-modding.
Select each one and extract (not decompile).
Open the drawable-hdpi folders side-by-side of the original and the theme, and drag (Copy) the ones you want to the original.
Then Zip the original and select System APK, and you're done. The reason this work is because the .9 files are still in their compiled state.
If you need to copy xml files, do this first, then the first step for png files: Decompile the two, copy the XML files, and recompile. Compiled XML files convert the png names to IDs which may be different between two roms. If you already have .9.png files that don't decompile, here's the fun part and I guess I'm doing all of this out of order, sorry...
Have an orginal apk decompiled with a different name, extract your modded apk, drag the drawable-hdpi out to say desktop, delete that project, decompile, drag the original decompiled drawable-hdpi into your modded one, and now you can edit/copy XML files and recompile. Then delete the project, extract, delete drawable-hdpi and drag the desktop drawable-hdpi to the project and zip it up. Done.
Or quick version.. 7zip helps.
right click the apk you want the images from, extract it.
right click open archive the apk you want the images in.
navage down to the folder that the images are stored in while in 7zip.
go back to the extracted folder and navagate down to the folder the images you want are in.
drag and drop them into the open archive 7zip window.
close archive
push
whiteguypl said:
Or quick version.. 7zip helps.
right click the apk you want the images from, extract it.
right click open archive the apk you want the images in.
navage down to the folder that the images are stored in while in 7zip.
go back to the extracted folder and navagate down to the folder the images you want are in.
drag and drop them into the open archive 7zip window.
close archive
push
Click to expand...
Click to collapse
CuriousTech said:
The problem you're having is with semi-transparent .9 files. The Android SDK png handler can't decompile them, so when you look at them in explorer they'll have a default image meaning they're corrupt.
The easiest way to deal with them is to not decompile and recompile.
PNG Only: With apk manager, take the original framework files from the ROM (or phone if stock) and drop them into place-apk-here-for-modding, then take the themed frameworks, rename them (something like framework-resParagon.apk) and drop those into place-apk-here-for-modding.
Select each one and extract (not decompile).
Open the drawable-hdpi folders side-by-side of the original and the theme, and drag (Copy) the ones you want to the original.
Then Zip the original and select System APK, and you're done. The reason this work is because the .9 files are still in their compiled state.
If you need to copy xml files, do this first, then the first step for png files: Decompile the two, copy the XML files, and recompile. Compiled XML files convert the png names to IDs which may be different between two roms. If you already have .9.png files that don't decompile, here's the fun part and I guess I'm doing all of this out of order, sorry...
Have an orginal apk decompiled with a different name, extract your modded apk, drag the drawable-hdpi out to say desktop, delete that project, decompile, drag the original decompiled drawable-hdpi into your modded one, and now you can edit/copy XML files and recompile. Then delete the project, extract, delete drawable-hdpi and drag the desktop drawable-hdpi to the project and zip it up. Done.
Click to expand...
Click to collapse
Thanks guys! i knew there should be a simple solution!
will try this soon. and post results!
Yossi
Also make sure to double check the sizes, the height and width my be different and give you issues if you copy and past the pngs
Sent from my SGH-I897 using XDA App
Also with 2.2.1 there's a problem with compressed apk files, so in apk manager, you need to set compression to 0. It's not a problem when dropping them into an apk with 7zip.
Different sized png files are usually the expanded notification bar switches. The darkness theme for example uses smaller ones. The size change is in twframework-res.apk/res/layout/status_bar_expanded.xml so those should be copied together (decompiled).
Another way to customize just 1 or a few .xml or .9.png files is to decompile the original, edit the xml or .9.png (with your modified one in mind), then compile. Then rip the compiled files from it and drop them into the themed one, assuming you already used the original the first time.
CuriousTech said:
Also with 2.2.1 there's a problem with compressed apk files, so in apk manager, you need to set compression to 0. It's not a problem when dropping them into an apk with 7zip.
Different sized png files are usually the expanded notification bar switches. The darkness theme for example uses smaller ones. The size change is in twframework-res.apk/res/layout/status_bar_expanded.xml so those should be copied together (decompiled).
Another way to customize just 1 or a few .xml or .9.png files is to decompile the original, edit the xml or .9.png (with your modified one in mind), then compile. Then rip the compiled files from it and drop them into the themed one, assuming you already used the original the first time.
Click to expand...
Click to collapse
so, double - checking that i understood...
method1: replacing images (same size) using copmpiled source and destination.
if i want to copy iver png's from one theme to another, i only decompress (or 7ZIP - open) the apk's - Replace the pics, and compress bacl (with compression set to 0).
method 2 : replacing images of different sizes
if the images are of different sizes, i should decompile both apk's, than i should copy the corrosponding XML from the new image's source, and drop in the original drawable directory, compile the apk, than copy over the image using method 1.
am i correct?
Thank you all for your help!!!
Yossi
In method 1, don't decompress it when using 7zip (or any other), just open the apk, drop the files in where they go, leaving the apk (zip) intact. If you extract the full apk, modify the files, and compress it back to a new apk it will lose the signature. That's what apk manager does when you zip it and select "system APK". It copies the signature from the original to the new one. Think of it like a zip comment. It's not a file, but a chunk of data attached to the zip that can't be copied from one zip to another.
Method 2: Too complicated. Just use method 1 to do as much as you can.
Whoever put the theme together originally did it incorrectly/lazily.
If you want to spend the time fixing it, then you need to decompile the same version of the .apk (the Samsung stock version, for example) and copypasta the themed one on top of it, while keeping the 1 pixel border.
One more question...or maybe two
when i decompile a framework-res.apk, i only get one drawable-hdpi folder.
if i open the apk using 7zip...i have a 2 folders: one is the same... and and another one that have this name: drawable-hdpi-v4
i replaced all the items i wanted in the drawable-hdpi folder..uploaded to the phone...and nothing happend... than i tried copying over some items to the drawable-hdpi-v4 foder..than i saw the changes.... the question is... do i have to copy the files to both follders? or just the drawable-hdpi-v4 folder?
another question tha poped into my mind right now, is it common that after i replace the framework-res.apk, my accounts data gets erased? (gmail account, facebook, etc)?
Thanks!
Yossi
Get the apktool in this thread and rename your old one just in case:
http://forum.xda-developers.com/showthread.php?t=864424&page=5
Oh, read the thread too. Good info!
The -v4 folders are higher resolution, or supposed to be. They take priority over the others, so if the image is only in drawable-hdpi it will be used, if it's in both the -v4 is used, or if it's only in -v4 it's used. I just leave the non-v4 alone, but it might save space to empty it, just scared to try.
You shouldn't lose account data though. That might indicate a problem. Not sure?
MikeyMike01 said:
Whoever put the theme together originally did it incorrectly/lazily.
Click to expand...
Click to collapse
I don't think the theme makers are to blame. Try decompiling a stock apk, then set the opacity of any .9.png to anything but 100%, draw9patch it again, then compile, then decompile and try to view that png. It's going to be damaged.
Well, it's actually easier to photoshop a compiled one, then remove the .9 and drop in draw9patch but you know what I mean.
I just don't think apktool can handle the extra info in a png.
Hey guyz. I have a Samsung Galaxy 5 (GT-i5503). I have installed froyo on it now from samfirmware.com. Right now I'm using a custom ROM from a guy named motafoca. I don't like the battery icons so I thought of changing it to the icons which indicated 1-100% and looked like the default one. So I pulled the framework-res.apk file from the framework directory and added the battery icons through 7zip. I also replaced the xml files in the drawable folder namely stat_sys_battery.xml, and two more files. After that the battery icon disappeared because I had the xml files from the battery mod. Figured out , it had got something to do with the xml file, I tried replacing the original files back but my phone got stuch in boot loop. So, I reflashed and its working now. After reading lot of information on this forum, I understood that we need to decompile the apk file so that we can edit the xml files. I did that and edited the xml files as necessary. Now, when I try to recompile the apk file with apk tool or apkmanager, I am getting an error saying the "Public symbol drawable/filename declared here is not defined" I am getting this error on many files including the ones that I have added. In one of the topics, somebody had suggested that we add the png files through 7zip without extracting the apk and then decompiling the apk so that the public.xml will autogenerate the ids for the new files, but that is not working. Can anyone help please? I am attaching the framework-res.apk file for reference.
Help!-
Sent from my GT-I5500L using XDA App
Bump!
Btw, did you ever get the answer?
Once you decompile the apk with apktool/apkmanager, and add your images and edited xml files, then you will need to delete res/values/public.xml; finally you can recompile the apk file and public.xml will be generated as it is building. Hope this helps.
I realize this is an old thread, but it appears the answer would still be appreciated.
I tried that, but it just gives me a bootloop.
Hi,
i'am searching for a guide how to manipulate correctly the framework-res.apk.
All ways i have tested fails.
I would modify some symbols in Notification bar (battery 1%) but all Time the my Phone run into bootloop or all Application Crashes after Startup.
I've tryed Apk Manager 4.9 / and Manualy with apktool.
Help plz .....
what i did :
1-extract apk (i use 7zip/WinRAR)
2-edit/replace image file(s)
3-repack with zero compression level ('store' level)
4-sign the apk
5-replace file using apk or create flashable recovery zip.
regards.
signing the framework-res.apk will not work.. will make the device go into bootloop
what you need is extract the framework-res.apk using apktool and edit the things you want and then compile it again using apktool .... now open the original framework-res.apk and replace the file resources.arsc with the edited compiled one..
this way you will retain the signature of the original framework-res.apk
PapaDocta said:
signing the framework-res.apk will not work.. will make the device go into bootloop
what you need is extract the framework-res.apk using apktool and edit the things you want and then compile it again using apktool .... now open the original framework-res.apk and replace the file resources.arsc with the edited compiled one..
this way you will retain the signature of the original framework-res.apk
Click to expand...
Click to collapse
But when i add some new Files and Edit some XML the Sign will be Corrupted ?
no it won't...
You need to do two copies.. the original file and the moded one...
1. make a backup of the original file
2. extract the original file using apktool
3. edit and modify anything you like
4. compile the edited file
5. rename the compiled file to framework-res.zip and take the modified resources.arsc
6. using winrar or 7zip open (to view not extract) the backed up framework-res.apk
7. place the moded resources.arsc into the backed up framework-res.apk
by doing this you retain the original signature of the backed up file and not breaking it..
Thx, will test it ;-)
kowalski99 said:
But when i add some new Files and Edit some XML the Sign will be Corrupted ?
Click to expand...
Click to collapse
Android system, signs system apk's on boot, you shouldnt sign them
Sent from my Desire HD using Tapatalk
My signed apk just work well.
AFAIK, we only cant re-sign htc's apk.
PapaDocta said:
signing the framework-res.apk will not work.. will make the device go into bootloop
what you need is extract the framework-res.apk using apktool and edit the things you want and then compile it again using apktool .... now open the original framework-res.apk and replace the file resources.arsc with the edited compiled one..
this way you will retain the signature of the original framework-res.apk
Click to expand...
Click to collapse
The right approach always depends, what you want to change. There is no need to decompile, if you only change a few standard png. If you change xml in values folder like color, styles or arrays, you can certainly not delete resources.arsc - resources have nothing to do with the signature anyway. So if you want to play safe, you should insert the original Meta-Inf (signature) and Android Manifest after compile. It is also recommended to zipalign the final apk in order to reduce RAM usage.
thanks he_stheone64 for the clarification.. i reached that conclusion based on my own research on the net and yeah i used to change the XML files to add language support and that the only way that worked with me..
And be sure to have a working and up-to-date sdk before trying to use apktool...
First, using a old sdk release i got a partially working result (few graphics bugs and strange reboots), then with a badly updated sdk on top off the old i got apktool making many errors. Finally, re-installing the last sdk from start i got apktool and my resulting apk working correctly.
Hi guys,
im currently using netdrg`s sense theme http://forum.xda-developers.com/showthread.php?t=1048792
Now i changed all the green elements of the framework-res.apk to blue. Ive done everything so far, but i have no clue how to edit the color of the progress bar. (the bar when u change the volume, download something and so on...)
Ive heard that u have to edit an xml file, but as i have no clue about editing these files, i want to ask for a little favour.
Ive attached the xml file, and the color which i will use is 1761ab (hex).
So ill thank the guy who will do this for me a thousand times and i can share the theme with you afterwards!
lg l
In order to edit this xml file you need to decompile framework-res.apk. You can use apk_manager. Once the framework has been decompiled you can easily change the hex color for the progress bar (remember that the first 2 digit are for alpha channel). After that you need to recompile the framework. Actually there is another way to do that, but it‘s a bit triky as you need to modify the xmls file by using an hex editor..
If you want i can modify and compile the xml attached for you! Let me know m8
hey, thanks for your answer.
I put the framework-res.apk in the "place here for modding" folder, opened the script and hit 9 to decompile.
Then i edited all the values in the xml file in the "projects" folder and saved it.
Now i compile it, delete the file i edited in the "keep" folder and that other file mentioned.
Now i tried to apply the compiled framework_res.apk back to the system which results in a bootloop, what am i doin wrong?
soulcrash said:
hey, thanks for your answer.
I put the framework-res.apk in the "place here for modding" folder, opened the script and hit 9 to decompile.
Then i edited all the values in the xml file in the "projects" folder and saved it.
Now i compile it, delete the file i edited in the "keep" folder and that other file mentioned.
Now i tried to apply the compiled framework_res.apk back to the system which results in a bootloop, what am i doin wrong?
Click to expand...
Click to collapse
Ok, you are getting close to the solution
Once you got the unsignedframework.zip inside the place-apk-here-for-modding folder, you have to do a little trick in order to get it working...
Unzip all the content of the "unsignedframework-res.apk". You should have 5 objects (3 folders, 2 files).
Zip these files with Winrar/Winzip (whatever) but you must choose "No compression (store)" method to zip it.
Rename this zip into "framework-res.apk".
Put it into an update.zip and it should be OK to flash trough the recovery mode.
keep me updated
NOTE: If you want to edit framework-res.apk or systemui.apk, follow this guide, it's the best available:good:
http://forum.xda-developers.com/showthread.php?t=2086771
Now, lets start
smali, dex....whaaat?
It's simple our odexed ROMs have .apk which use .odex files which contain cache. When the ROM is deodexed the .apk contains classes.dex which now contains information present in the .odex files!:good:
Smali is nothing but disassembled .dex file! The .dex file is disassembled into java code which can be edited via Notepad ++( simple notepad works too)
WHY?
Why do you need to edit classes.dex !
For me, i was trying to make CRT on/off animation which required editing classes.dex in service.jar!
More edits where classes.dex inside services.jar is needed
- Changing status bar clock color
- Changing text color in notification bar
- More? Tell Me!:highfive:
HOW?
Requirements: Java SDK!
I have APK Multi Tool, although it decompiles .apk and .dex files inside the apk, it doesn't provide option to decompile a separate classes.dex!
Still it's best software for decompiling apks and more!
Smali-Me 1.0
Download and Instructions:
http://www.wrapcode.com/android/baksmali-smali-dex-files/
ROM Tools by iamareebjamal - More noob friendly
http://forum.xda-developers.com/showthread.php?t=2163286
Once you have decompiled classes.dex, you'll get various folder with various files. Edit the files required and then recompile!
So after generating new classes.dex, put it back to services.jar by opening the file in winzip!:good:
ONE MORE THING
Make your own flashable zip
The recompiled systemui.apk or framework-res.apk, when pushed via root explorer give lot of force closes. This is normal, however if u wish to avoid it u can create a cwm flashable zip for the same!:good:
I'm attaching the sample.zip here and u can add your files in the specified folders. For more details read the source forum:
http://forum.xda-developers.com/showthread.php?t=1721680
Reserved- for more stuff!
Subscribed.. will see what it is later
Hey, add this to your guide, i far more easier and nice to look at too than smali me
http://forum.xda-developers.com/showthread.php?p=40435351#post40435351