[Q] Help me modding framework-res.apk please... - General Questions and Answers

So, I tried modding the framework-res.apk and systemUI.apk on my ROM (GlassROM Iridiscent), and I used UOT Kitchen. I wanted:
1 - I wanted to get this Battery icon:
http://i.imgur.com/lCjdIJ4.png
This isn't a priority now, since I can easily add this later with UOT. However, I tried decompiling my framework apk, making my changes and recompiling, but then my Galaxy Gio wouldn't boot.
2 - I wanted the easter egg for JB to be green.
Here are the files I recoloured. They were at "framework-res\res\drawable-nodpi"
File: https://www.mediafire.com/?5uasn9slymzi9fa
3 - I wanted to change the USB connected android to the one in the file below.
https://www.mediafire.com/?j6xeqxh5f80wy40
I edited this file, which was under framework-res\res\drawable-mdpi
4 - I wanted to change the default_wallpaper to the one in KitKat:
http://cdn.androidpolice.com/wp-content/uploads/2013/11/nexusae0_default_wallpaper1.jpg
Help me please, and do the 2, 3 and 4, at least...
Here are my files:
- original working framework-res.apk --> https://www.mediafire.com/?k1p5ndgaa94crm7
- original working SystemUI.apk -->https://www.mediafire.com/?221abjo35bbt4ma
- My decompiled and modified framework-res.apk --> https://www.mediafire.com/?dm2ifr6cnreh95c
If you manage to do this, after you've sent me the working files, I can give you up to 1 USD via Paypal.
Thanks in advance!

Related

[GUIDE] Newbie's How To: Port Theme's

How To Port Theme's
(Using Apktool, and Theme Porter)
Since there are some people out there willing to learn but not exactly able to with all of the convoluted information on the forums, I decided I'd start putting together a guide similar to other's to aid those trying to learn. Stay tuned as this is under construction!
All credit is due to original creators of the product's used in this process, without them there wouldn't be a reason for this guide . Please be respectful of other's work, sometimes it's best to ask before attempting (if it is an original product) but at very least give credit and a link back.
What is porting?
Porting very basically is taking .png files and XML changes from one theme (typically created for a different model, but using the same resolution) and copying them into deodexed stock rom's such as EC10/EE19 Pick and Pack so that they can be flashed onto our phones and used with our framework and/or updated framework.
Sounds really easy, doesn't it? At first it will be cumbersome and frustrating, but after you've used the processes enough you will be able to snap these out in 30 minutes or less! The problem lies in the way these files are packaged, they are mainly just a .zip file that isn't compressed, however there is another layer to an .apk that you can only see once you've learned how to use tools such as apktool/apkmanager. The other tool we will use to aid us in this painstaking process is an application called Theme Porter, which essentially is a script that has been written that will do all of the legwork for us. Let's get started!
What will I need?
Apktool I currently use an older version of the program, you can download here, this one I know works for sure - last I heard the other has issues.
ThemePorter
7zip (Win rar could be used instead)
Notepad++ (Or equivalent code editing software) which will be used to make the xml changes. If you're not familiar with using something such as this, you may want to take time to research before attempting to port.
How to set up;
Begin by getting ThemePorter setup, you just need to unzip the download and that will be "theme porter" It is basically just made up of a few folders, and has a batch script that you will use to initiate the process. I just place mine on the desktop for easy access.
Secondly, get apktool downloaded and unzipped. place the apt folder somewhere where you can easily navigate to it through a command prompt. C: might be a good place if you want to save yourself some keystrokes.
Next just make sure you have notepad++ or another editor installed for use later.
Lastly, get 7zip installed so that you're able to open .apk and .zip files without actually extracting the files.
Where do I get my source files?
You can use any framework from any rom that can be decompiled correctly with apktool. This means when you decompile it, there are no errors and it generates a folder with the same name. Download the rom of your choice and save it (still zipped) somewhere on your desktop, and make an extra copy in case you mess up and overwrite the wrong files. You will ALWAYS use these in the NEW folder within theme porter, but we will get to that.
As for the theme you're trying to port, I usually use fascinate theme's, because it is basically a direct copy of our phone (Note: As of 2.2 they now have a Data on/off icon in their status pull down, where we have Silence, so this will often need to be taken care of separate from this process.) I've also recently started using Vibrant theme's, as these are also very similar - but there are tweaks with these too and I will try to cover them in the guide at some point. You may find others that will work too, at this point this is all I've had time to mess with. Either way, download the .ZIP file and also place it somewhere easy to access.
This is where it get's sort of difficult.
Stock ROM's have some differences to theme's that theme porter cannot handle for you. These are basically MOD's that may exist in the theme ROM and/or XML changes that have been made to alter text color's to accommodate the theme (black to white, white to black, etc.) These changes WILL NOT be ported over using theme porter and unfortunately also cannot be made AFTER using theme porter, so there is a certain process to go about this.
Now enter's apktool. Apktool is a script brut.all very kindly wrote to assist android developers in decompiling/recompiling .apk files without losing structure that normal compression software breaks. Basically there are two reasons you will need to take this step.
When;
Editing Text Color- When choosing a theme to port you will need to pay attention to the screenshots the original poster has posted, as these will clue you in whether or not this needs to happen.
The Pick and Pack rom is essentially still stock, as far as XML goes - so the text on menu's for example, will be Black text on a white background. If the theme you chose has something different, you will need to take this step so that the text is legible in the final theme.
Adding accurate battery MOD- Also when choosing a theme you will need to take a look at the framework-res.apk file to determine if the themer has added the accurate battery mod. Essentially all this means is the XML and image's have been edited to show you each percentage of battery life vs. the stock one that only shows odd increments of 10/15/20.
Open framework-res.apk with 7zip
Navigate to res/drawable-hdpi (this also may be drawable-hdpi-v4 depending on your theme, I haven't quite figured out why this is)
Scroll down until you see the status_battery icons near the bottom - if there are not images for every percentage - then no mod exist's and you can skip using apktool for this step.
How;
For either change you will follow this process to decompile To gain access to the XML/PNG files that contain these text values, we will need to decompile the framework-res.apk file from the rom.
Copy framework-res.apk from the rom and place in the APT folder created earlier.
Rename this to something shorter such as "FW.apk" for easier command lines
Start a command prompt (in windows 7 type "cmd" in the search bar within start menu)
Navigate to the APT folder, For example;
Code:
CD c:\Users\brandon\Desktop\apt
Type
Code:
apktool d FW.apk
This will decompile the .apk into a folder called FW within the APT folder, allowing you access to the files. I will cover the actual changes in a later post.
At this point you have the files in a folder and they can be edited how you see fit (should you choose to just edit the stock ones vs. actually porting already changed ones).
You'll notice when examining the folder that there are quite a bit more files. Also, you will be introduced to the .9.png file type, which essentially is just a .png file that has some black lines embedded in the file to instruct android how to resize and reuse the image within the framework.
Any edits made to these files must be made carefully, as to not alter the integrity of these black lines. When the file is recompiled, the lines will disappear but will be included (if you tried doing this without decompiling - your photo editor would nix these lines and android wouldn't know how to size them)
If all your edits were complete, you would then recompile the file through apktool. (I will continue with the theme porting guide in the next step, this is just a good reference point for these steps.)
Type this into the command prompt
Code:
apktool b FW framework-res.apk
This would then create the framework-res.apk file in the APT folder, however there is an important step here. During this process the META folder is lost, and the AndroidManifest file is corrupted.
Delete the AndroidManifest.xml file from the new framework-res.apk
Copy the META-INF folder and the AndroidManfiest.xml file from the ORIGINAL framework-res.apk (now named FW.apk in this example) and place it in the new framework-res.apk using 7zip (do not extract the file, open the archive with 7zip.)
At this point, your framework could be ready for replacing in your theme.zip (will be covered later) with the edit's you've made Or if you're learning how to port theme's, continue reading.
Guide Part 2....
Preparing for Theme Porter
Okay now that we have some of the side process out of the way, let's get back to the guide.
Determine if you need to make any XML edit's for battery or text color changes and perform them per the processes detailed below. If you do not need to make them, you may skip this step completely and move on to using theme porter.
Correcting Accurate Battery Mod Animations-
Follow this guide to make the changes to the framework to use the new charging animation images and will allow you to then use theme porter to swap the .png files
Decompile the framework-res.apk from the ROM download (I usually just rename this to EE19.apk or whatever the rom is i'm working with)
Decompile the framework-res.apk (I first rename the framework-res.apk file to NEW.apk (or whatever you wish) Note: It will typcially give you errors (unless it's theme'd correctly) but you're just after some code from a few .xml files so don't worry.
In the NEW folder Navigate to
Code:
\res\drawable-hdpi\
or
\res\drawable-hdpi-v4\
Copy all of the battery charging .png's and drag them to a folder on your desktop. Then open the EE19 folder within APT (the one you decompiled from the rom you're working from) Drag those images into the /res/drawable-hdpi-v4 directory replacing any existing ones.
open the following file in notepad++
Code:
\apt\NEW\res\drawable\stat_sys_battery_charge.xml
Also open the same file within the EE19 decompiled folder
In the THEME xml file select all and copy
In the EE19 xml file, paste this replacing the text. Then save it overwriting the original.
At this point, the battery mod is done and the new .png files exist so that theme porter can do it's work (And the xml is there to make it works when it get's to your phone). If you don't have any text edits to make, you can recompile the apk (as stated in steps in first post) and move on to steps below (skipping the section on changing text).
Changing text colors-
If you have determined that the text in the theme is different from the rom framework (I.E. Text on notifications, menu's, etc.) then you will follow these steps to locate where these changes need to be made.
If you haven't already, decompile the framework-res.apk from the Rom.
Next, determine what text color edit's you need to make and then use this wonderful reference to determine which actual files those edit's correspond to.
Locate the file you need to edit in the decompiled folder, and open it with 7zip.
Typically removing the "inverse" reference on the color line will change it from black to white, or white to black and is the easiest/best way to alter colors in a ROM. (For a quick note, searching for "menu" in the styles.xml files located in /values/ will give you the items you need to change, watch for _bright references for the dividers, change those to _dark instead.
Once you are done making these edits, recompile the folder as stated in first post. And move on to using theme porter.
Using Theme Porter-PAY CLOSE ATTENTION HERE.
Now that you have the appropriate prep-work done, the easy part finally comes. (Hopefully)
Copy and paste the applications & framework-res.apk twframework-res.apk files from the THEME.zip into the appropriate folders within the OLD folder in theme porter.
Now copy and paste the same files that you copied from the theme.zip, now from the rom (EE19 for example) to the NEW folder in theme porter.
Once all files are in appropriate folders, run the Script.bat file in theme porter. Use a selection of "1" and press enter.
Theme porter will now copy all of the .png files from one .apk to the other (where the folder names are an exact match)
NOTE:At this step, you may have issues where the images aren't brought over (This typically only effects the framework files and just depends on how the file was generated/edited). This can be detrmined by opening the .apk in 7zip and pulling out the res folder, where you can view the files (you will see if it's been changed or not) If it hasn't, you will need to make sure the folder within the Themed .apk's are the exact same as the ROM you're themeing and re-run the theme porter script. (meaning you need to add or remove the -v4 ending depending on where the previous themer placed the themed files)
If you're lucky, everything is done at this point and you can move on to packaging a flashable update.zip.
Packaging A Flashable Update.Zip
A flashable package is simply a .zip file (stored as "store" in 7zip, no compression) that is made up of META-INF and System folders. The META-INF folder is very important as there is a big difference between using one from a ROM (pick and pick) and a theme (NeonGT) You will need to download a theme and pull the META-INF folder out so that you can use it in your theme ports. This is to ensure you have the correct script (edify or ammend) typically now we're using edify so use one from one of the H57 theme's via baked_tator The system folder should contain two folders "framework" and "app" each of which will hold the respective .apk files you have been working with. (but could also contain a "Media" folder for changing bootanimation.zip files, basically any files within the folder structure you create (matches the system structure) will be replaced when flashed. So be careful not to include things I haven't listed here unless you know what you're doing. And be sure to test these things before even thinking about a release.
Create the following folder that can be re-used with any new theme port, it's the easiest way to keep things organized and not lose track of files.
Create a new folder on your desktop called New Theme
Within that folder paste in the META-INF folder from another EE19 theme.
Create a new folder called "system"
Open system and create two new folders "app" and "framework" (and "media" if you are including the bootanimation.zip from the theme (which typically will work on our phone)
Place approprate files from the NEW folder within theme porter into these folders, respectively
Back up so that you see the META-INF folder and System folder, select those two, right-click and select "add to archive" in the 7zip menu.
Name the file "EE19 ThemeName VX.zip" and select "Store" for the method
Drag this to your desktop and this will be what you will place on your SD card for flashing.
Test the theme thoroughly to make sure everything ported over and everything still works (make sure to test USB, even color XML edits can cause odd issues) and get help from others to make sure the bugs are out.
If you run into issues, check the next post for possible resolutions.
BE SURE TO CREDIT THE PROPER CREATORS!!! I can't express this enough, I have a format for the way I do release posts, feel free to copy it if you'd like but either way make sure you make it known that it's not your work!
FAQ / Common Issues / Other Resources
Common Issues:
Images do not transfer to new framework.apk files.
(typically the applications all have the same folder names, so no problems occur here.)
As stated in the guide, all folders within each res folder within each .apk file used in theme porter must have exact matching folders/files for the .png to actually transfer. If it's been edited with apktool, it typically has the -v4 extension.
Troubleshoot your issue by opening the resulting .apk file in 7zip and comparing to the downloaded theme file in 7zip. You may have to pull the res folders out and look that way to actually see which images didn't transfer.
First thing to check is the folder names within the res folder, if the rom folder's names are "drawable-hdpi" and "drawable-land-hdpi" and the theme has "drawable-hdp-v4" then you need to remove the -v4 from those folders and run theme porter again.
NOTE: I've also run into situations where both folder's existed in the .apk file, meaning both drawable-hdpi and drawable-hdpi-v4 folders were there, but only one actually had the themed .pngs. In this case it was the drawable-hdpi folder that had the themed ones, but I needed it to be -v4, so I deleted the existing -v4 folders and renamed the others to -v4 - this also slimmed the rom because you really don't need the extra folders/files (nor wan't them!)
Some times icons don't exist on other phones, or they are completely different icons. I.E. with 2.2 fascinate theme's the Silence icon does not exist and therefore would need to be pulled from another theme or created to be fixed. This can be done with 7zip, no need to decompile the file if you're just swapping .png files (in the final framework-res.apk .
[*]Problems after testing theme.
This has happened to me on all sorts of levels;
Problems Restoring - Sometimes after testing theme's you'll go to restore and things will not be right when you boot, FC's and whatnot. Best case scenario you can restore to a vanilla restore (meaning your rom + any app's you wanted, but no theme's) or just flash your rom to fix.
Problems with icon's not being correct on a restore or a flash.
Same as above, sometimes things just go awry when you're flashing theme on top of theme, so i'ts best to start from the rom. Make a restore point with your rom + all your apps, then you can always go back to it and flash your day to day theme - this will give you the least trouble.
Phone stuck in airplane mode, setting is disabled.
I had this happen to me randomly once, no idea why but if you do run into this the only thing that fixed it for me was an odin back to a full build. No restore or flash would fix it. Typically your problem should be solved with a fresh flash of your rom, but sometimes going to a full build with odin is the only way.
FAQ:
Post them and we'll get them answered and edited in here. So far I've tried to cover everything I knew of in the guide .
Reserved
Reserved
Reserved
Other Resourcs:
Great guide by nitsuj17 on how to theme
Hex Colors
Free Photoshop Alternative
XML Color Edit Guide - in case you missed it above - credits to KBanause
wow, you rock bde. thanks for your time and help with this, I will be following it to help you guys out with stuff more.
Sent from my SCH-I500 using Tapatalk
sageDieu said:
wow, you rock bde. thanks for your time and help with this, I will be following it to help you guys out with stuff more.
Sent from my SCH-I500 using Tapatalk
Click to expand...
Click to collapse
Great, and thanks, I'm glad to share what I've learned with the community
Great write up,ive read through it several times. Just wish I hadn't traded my desktop for tattoo work this weekend. ..
Sent from my SCH-I500 using Tapatalk
man you write some good tutorials...
Very thorough and still easy to understand, Great work!!
Very nice! Just fixed the white on white text in my super light port. Big Thanks!
Great write up!
So, I tried using apktool to decompile the framwork-res.apk and it worked fine, recompiled it and everything was good, are these the same steps I would use for other APK's such as in the apps folder (i.e. Settings.apk) because I cannot get them to work I keep getting brut.androlib errors
bwot75 said:
So, I tried using apktool to decompile the framwork-res.apk and it worked fine, recompiled it and everything was good, are these the same steps I would use for other APK's such as in the apps folder (i.e. Settings.apk) because I cannot get them to work I keep getting brut.androlib errors
Click to expand...
Click to collapse
Usually if you get errors in compiling there have been things added or removed after compiling, this is sometimes caused by using theme porter for example.
Apktool works on any apk, but i'ts fussy about what's there before it recompiles. Try decompiling and recompiling with no changes, if it doesn't work then it won't work on that .apk (to my knowledge). You basically will always need to start with one of the deodexed apks from phidelt's pick and pack, then add changes while i'ts decompiled, then run theme porter after it's recompiled if needed.
And glad you all appreciate it
I vote sticky on this how-to...very good write up and it makes my life easier!!!
Definitely sticky
Sent from my SCH-I500 using XDA App
Thanks for the good reading bde. great tutorial.
Hey thanks, glad to share the wealth
Sent from my SCH-I500 using XDA Premium App
I followed this guide and made XML editing for Framework-res.apk to change font colour in the Menu using Notepad++, but after xml edit, cant build the framework.apk, it says sources have changed and does not build the apk. Am using apktool for this. Any suggestions how to go about it. Or somebody can guide, how can I change the menu background so that Menu texts are visible?
trip007in said:
I followed this guide and made XML editing for Framework-res.apk to change font colour in the Menu using Notepad++, but after xml edit, cant build the framework.apk, it says sources have changed and does not build the apk. Am using apktool for this. Any suggestions how to go about it. Or somebody can guide, how can I change the menu background so that Menu texts are visible?
Click to expand...
Click to collapse
As stated in an above post, try decompiling the framework-res.apk you are working with - without any edits and see if it will recompile with no error. If it doesn't then re-read my guide
Ok thanks will check it.
Never mind, I figured it out.
Sent from my SCH-I500 using XDA App
I did some major fixin' on the OP, hope it's more clear!

Help with 10% increments on Blur 3.4.2

Reading another thread I found out how to successfully get the battery icons to drop by 10% increments, but when I go into settings I can not go into settings and select battery manager. It causes the settings to force close.
I must missing something somewhere. Here are my steps I took.
1. Decompile framework-res.apk
2. Edit stat_sys_battery.xml in both /drawable a drawable-hdpi.
Added in all of the stat_sys_battery.png's
3. Recompile framework-res.apk
4. Using win-rar replace META-INF and AndroidManifest.xml from the original framew res.apk
5. Pushed the framework-res.apk to my phone
Now it seems the phone functions properly, but most of all the options in settings cause settings to force close.
Any help on this matter would be greatly appreciated.
Sent from my DROIDX using DroidForums App
Sent from my DROIDX using XDA App
I personally find it hilarious that even on 3.4.2 which is the newest release, motorola still has not fixed the battery manager force close issue... theyve had like four OTA updates now since it originally came out and still nothing
is 3.4.2 an official release from Moto and Verizon?
sent from the xda premium app for android
1. Decompile framework-res.apk (save a copy for modifications later)
2. Edit stat_sys_battery.xml in both /drawable a drawable-hdpi.
3. Added in all of the stat_sys_battery.png's
4. Recompile framework-res.apk
5. Using win-rar copy everything, with the exception of the res folder, that's changed from the newframework-res.apk to the original you saved for Modding. Your goal is to end up using the ORIGINAL .apk not the recompiled one. I think you need resource.arsc and android manifest only (not sure).
6. Replace the xmls in the original fw with the new ones and do the same with the pngs. You should have slightly more pngs (additional percentages) than before.
5. Pushed the modified OLD framework-res.apk to my phone
GL
Thank you for the response. I did get it to work correctly, my big mistake, was during the recompile. I used apk manager and it asks if you would like to keep all unchanged files from the original, them makes a keep folder and you delete what you changed. And if an xml gets edited to also delete the resources file. Then use the new apk and replace the meta and androidmanifest. Works great now. Now I just need to make new battery meter that is easier to read hout or make new battery icons as these were made for
Sent from my DROIDX using XDA App
Doh! I thought you were trying to modify a themed framework-res.apk (stock framework can be decompiled/recompiled with no issues).
Glad you got it working.

[Q] Modifying Xperia's framework == bootloop

Hi men,
I've searched and looked several threads about recompiling framework but still don't know what I'm doing wrong. I'd be very pleased if you could help me. This is my case:
I use the last one version of apktool and follow this guide (scroll down a little bit to see the tutorial) in order to add Magnifier Glass to my Xperia S framework.
I follow these steps:
1. Install framework-res.apk
2. Decompile it
3. Edit dimens.xml and public.xml and add drawable resources to hdpi folder
4. Recompile it
5. Decompile framework.jar, make changes and recompile it with smali and baksmali.jar
6. Copy META-INF and AndroidManifiest.xml from the original framework to the new one using 7zip
7. Make a flasheable zip and install it via CWM
8. Bootloop
I know it could be a very silly thing I'm doing wrong, in fact, it's the second time I'm trying to edit xml on framework.
I hope your answers guys.
Thanks you very much!!!
bump!
rockernaxo said:
Hi men,
I've searched and looked several threads about recompiling framework but still don't know what I'm doing wrong. I'd be very pleased if you could help me. This is my case:
I use the last one version of apktool and follow this guide (scroll down a little bit to see the tutorial) in order to add Magnifier Glass to my Xperia S framework.
I follow these steps:
1. Install framework-res.apk
2. Decompile it
3. Edit dimens.xml and public.xml and add drawable resources to hdpi folder
4. Recompile it
5. Decompile framework.jar, make changes and recompile it with smali and baksmali.jar
6. Copy META-INF and AndroidManifiest.xml from the original framework to the new one using 7zip
7. Make a flasheable zip and install it via CWM
8. Bootloop
I know it could be a very silly thing I'm doing wrong, in fact, it's the second time I'm trying to edit xml on framework.
I hope your answers guys.
Thanks you very much!!!
Click to expand...
Click to collapse
Good evening.
Follow the link. I tested and it works.
http://forum.xda-developers.com/showthread.php?t=1943855
Juliano303 said:
Good evening.
Follow the link. I tested and it works.
http://forum.xda-developers.com/showthread.php?t=1943855
Click to expand...
Click to collapse
It definitely worked!!! Thanks you very much!!!
I tested this method previously and didn't work, but now goes fine.

[Q] The resources.arsc of framework-res is not recompiling with APK Multitool

Hi there
I am facing a strange problem. I am decompiling resources.arsc using APK Multitool (from official site) with no problems. I then change a few colors in res\values\colors.xml. Then I recompile and delete the resources.arsc from the keep folder as instructed. The apk colpiles ok but to my surprise there is no change in the colors. I decompile it again only to find that the changes i made have been reverted.
Amusingly enough I tried APK Multitool Stable Release from this thread http://forum.xda-developers.com/showthread.php?t=2341351 And it recompiles fine and even the resources.arsc is changes (via time stamp and size) but the framework-res when pushed through adb causes bootloop.
I am stuck at this point. Any help would be greatly appreciated.
I am on a Micormax A52 with Gingerbread 2.3.7 (Stock).
Thank You

[TW][MOD][PORT] MIUI 5 Icons for TW + link to guide.

This stuff comes from SGS3 and some CSC messing, but here it is:
http://forum.xda-developers.com/showthread.php?t=2263939
And here is what i acheived:
http://forum.xda-developers.com/showpost.php?p=45193128&postcount=73
All work is done by decompiling apk, removing all the xml and pictures, placing those back, recompiling.
After regeration of public.xml - you can generate CSCAppResource.xml.
At least we got icon theming in touchwiz.
Look for my port here:
http://www.mediafire.com/?diffphafc33t4iv
this is not a CWM package! unzip to /system/csc/appresource/ (if you don't have folder appresource - then create it)

Categories

Resources