[GUIDE] Decompile/Theme GingerBlur Framework

kennethpenn

Retired Forum Moderator / Retired Recognized Devel
Nov 29, 2006
2,703
3,773
0
Washington, D.C.
briefmobile.com
Hey everyone! I've created a guide for themers that shows step-by-step how to decompile and recompile the GingerBlur framework-res.apk. With GingerBlur 4, decompilation and recompilation can be done without any errors. This should make it significantly easier to theme my ROM.

http://briefmobile.com/how-to-theme-gingerblur

If you're unclear on how to do something, you should ask me below and I'll write more to the guide. In the future I'd like to add these to the guide:
  • Step-by-step "How To" create a theme like GingerBlur
  • How to edit .9.pngs properly
  • How to create flashable .zip's
  • How to change text/menu colors

Make sure to throw your suggestions below!
 
Last edited:

Swiftks

Retired Forum Moderator
Mar 16, 2011
3,741
1,910
0
The Woodlands, TX
Ok, so I'm not to familiar with themeing, but I figure replacing a few .png files in the drawable-hdpi folder can't be to hard... But every time I try re-compiling the framework-res.apk, I get multiple errors all having to do with the public.xml file, which I didn't touch.
I de-compile the apk just fine, replace the .png files with different ones (same names), and then get the error upon re-compiling. And then nothing appears in the build folder at all. Any thoughts??? Any help would be much appreciated. Thanks.

**Edit**

When I run the cmd to compile the framework-res folder, I get:
W: Could not find sources
I: Building Resources...
 
Last edited:
  • Like
Reactions: blader_rump

kennethpenn

Retired Forum Moderator / Retired Recognized Devel
Nov 29, 2006
2,703
3,773
0
Washington, D.C.
briefmobile.com
Ok, so I'm not to familiar with themeing, but I figure replacing a few .png files in the drawable-hdpi folder can't be to hard... But every time I try re-compiling the framework-res.apk, I get multiple errors all having to do with the public.xml file, which I didn't touch.
I de-compile the apk just fine, replace the .png files with different ones (same names), and then get the error upon re-compiling. And then nothing appears in the build folder at all. Any thoughts??? Any help would be much appreciated. Thanks.

**Edit**

When I run the cmd to compile the framework-res folder, I get:
W: Could not find sources
I: Building Resources...
Could you read out some of the errors?

Most .png files can be replaced within WinRAR or 7zip without decompiling the framework. Only ".9.png" files need decompilation and recompilation.
 

Paschalis

Senior Member
Mar 25, 2009
468
51
0
when decompiling i get this:

apktool d -f framework-res.apk

Code:
I: Loading resource table...
I: Loaded.
I: Decoding file-resources...
W: Cant find 9patch chunk in file: "drawable-hdpi/statusbar_background.9.png". R
enaming it to *.png.
W: Cant find 9patch chunk in file: "drawable-hdpi/title_bar_portrait.9.png". Ren
aming it to *.png.
I: Decoding values*/* XMLs...
I: Done.
I: Copying assets and libs...
that means it doesnt decompile correct the .9.png files?

when compiling, with minor changers in .9.png files i get these errors:

Code:
C:\FIXblur\framework-res\res\values\public.xml:3604: error: Public symbol drawab
le/sym_keyboard_space declared here is not defined.
....
le/tab_selected_bar_left_v4 declared here is not defined.
C:\FIXblur\framework-res\res\values\public.xml:3614: error: Public symbol drawab
le/tab_selected_bar_right declared here is not defined.
.....
.....
C:\FIXblur\framework-res\res\values\public.xml:3657: error: Public symbol drawab
le/zz_vzw_stat_sys_roaming_cdma_custom3 declared here is not defined.
btw the java jre i have is
Windows x64 16.09 MB jre-6u25-windows-x64.exe
(on my x64 win7)
 
Last edited:

kennethpenn

Retired Forum Moderator / Retired Recognized Devel
Nov 29, 2006
2,703
3,773
0
Washington, D.C.
briefmobile.com
when decompiling i get this:

apktool d -f framework-res.apk

Code:
I: Loading resource table...
I: Loaded.
I: Decoding file-resources...
W: Cant find 9patch chunk in file: "drawable-hdpi/statusbar_background.9.png". R
enaming it to *.png.
W: Cant find 9patch chunk in file: "drawable-hdpi/title_bar_portrait.9.png". Ren
aming it to *.png.
I: Decoding values*/* XMLs...
I: Done.
I: Copying assets and libs...
that means it doesnt decompile correct the .9.png files?

when compiling, with minor changers in .9.png files i get these errors:

Code:
C:\FIXblur\framework-res\res\values\public.xml:3604: error: Public symbol drawab
le/sym_keyboard_space declared here is not defined.
....
le/tab_selected_bar_left_v4 declared here is not defined.
C:\FIXblur\framework-res\res\values\public.xml:3614: error: Public symbol drawab
le/tab_selected_bar_right declared here is not defined.
.....
.....
C:\FIXblur\framework-res\res\values\public.xml:3657: error: Public symbol drawab
le/zz_vzw_stat_sys_roaming_cdma_custom3 declared here is not defined.
btw the java jre i have is
Windows x64 16.09 MB jre-6u25-windows-x64.exe
(on my x64 win7)
Make sure you're decompiling GingerBlur 4. Only GB4 has my new-and-improved framework-res.
 

NFHimself

Senior Member
Mar 12, 2008
816
469
0
Mount Pearl
If you have the android sdk installed, it's version of aapt might be causing conflicts depending on the version of apktool being used. Since apktool just grabs the first one it finds in it's path, keep an eye on that. For linux, there is no way to set the path for apktool, the code just calls aapt, to be found wherever on the system visible from within java, no shell PATH changes have any affect. I have a custom version I did up to force the location of aapt via command line option.

If you are using .9.png files, make sure they are .9.png files and not just regular files with that extension. Apktool is like Santa Claus, it can tell when you are being naughty or nice. :)

All the small xml files like strings.xml are jumbled together in resources.arsc, all the identifiers in your statusbar.xml etc are decoded and reassigned when apktool recompiles them. So keep a copy of your mods outside of the apk as backup, you might not be able to extract them exactly as you modified them. If you reference new drawables, make sure those files exist somewhere in the apk folder before compiling as well.

Cheers!
 
Last edited:
  • Like
Reactions: kennethpenn

lostinbeta

Senior Member
Oct 13, 2008
313
27
0
Ok, so I've never themed Android before, but I'd be interested in playing around with the option, there are a few questions I have though.

1) Do you have a downloadable framework-res.apk or do I need to just pull it via adb (I know how to do this, I was just wondering)?

2) If I push the new framework-res.apk what is the risk of getting the boot loop of death that tends to happen if you incorrectly theme a ROM?

3) If I were to be caught in a BLOD would that mean that I would need to restore via an sbf and start all over again or could I still access Tenfars CWM somehow during the boot process and restore to the last Nandroid backup?

4) Should the device be wiped before testing a theme, or is it OK to just push the new framework-res.apk over the existing without wiping?

I'm sure I will have more questions in the future. I just got apktools running on my Mac, but don't have much time at the moment to fiddle around with it. I'm a newbie when it comes to this stuff, but I do know enough to feel comfortable working with these files.

I want to thank you in advance, theming Android devices is something I've wanted to learn how to do since I started using Android and I look forward to dabbling with it. I also look forward to the information in the guides you list as wanting to write in the future. You are awesome kennethpenn.
 
Last edited:

Nottach

Senior Member
Mar 20, 2008
1,587
3,934
0
New York
1) Do you have a downloadable framework-res.apk or do I need to just pull it via adb (I know how to do this, I was just wondering)?
You can grab it from the GingerBlur CWM update zip. It is inside /system/framework.

2) If I push the new framework-res.apk what is the risk of getting the boot loop of death that tends to happen if you incorrectly theme a ROM?

3) If I were to be caught in a BLOD would that mean that I would need to restore via an sbf and start all over again or could I still access Tenfars CWM somehow during the boot process and restore to the last Nandroid backup?
If you keep a copy of GBlur on your sd then you can usually use CWM to recover from a BLOD. You may have to: disconnect from all power - pull the battery - with battery out plug into AC - CWM will start and you can reflash the working GBlur zip

4) Should the device be wiped before testing a theme, or is it OK to just push the new framework-res.apk over the existing without wiping?
Since a theme is basically image modifications there is no reason to wipe. To go fresh after applying a theme flash the DeOdexed CWM zip.
 
Last edited:

lostinbeta

Senior Member
Oct 13, 2008
313
27
0
Thank you for the info nottach, all seems pretty easy (I had already pulled the framework-res.apk from my phone, but I have the GB4 zip on my computer in case I need more copies).

There doesn't happen to be some sort of emulator for this is there? lol. I highly doubt there is, but it seems rather daunting to change a file, push the framework-res.apk then have to restart to see if the change was successful. All part of the game though, can't always expect things you aren't really supposed to be doing in the first place to be easy.
 

Nottach

Senior Member
Mar 20, 2008
1,587
3,934
0
New York
Thank you for the info nottach, all seems pretty easy (I had already pulled the framework-res.apk from my phone, but I have the GB4 zip on my computer in case I need more copies).

There doesn't happen to be some sort of emulator for this is there? lol. I highly doubt there is, but it seems rather daunting to change a file, push the framework-res.apk then have to restart to see if the change was successful. All part of the game though, can't always expect things you aren't really supposed to be doing in the first place to be easy.
No problem, the more themes the better.
I dont think there is an emulator, but there is an app that supposedly restarts the framework-res.apk. Ive never used it so I can't say if it works. Basically I'll make a ton of notes about changes that need to be made then ill carefully do one at a time. I always keep the latest few working versions of my themes on my sd while creating in case something goes wrong.

Heres the app i was talking about incase youre brave.
http://forum.xda-developers.com/showthread.php?t=1028541
 

Swiftks

Retired Forum Moderator
Mar 16, 2011
3,741
1,910
0
The Woodlands, TX
Ok, moment of truth... de-compiled & re-compiled framework-res.apk, changing multiple 9.pngs as well as normal .pngs... no errors on de-compile or re-compile... flashing now... Come on, no boot loop, no boot loop...

**Edit**

Success... thank God... think I got it down now... just takes some trial & error when beginning.
 
Last edited:

lostinbeta

Senior Member
Oct 13, 2008
313
27
0
So for anyone interested, here is a little tidbit that is pretty useful on how the whole .9.png (Or 9 Patch images) work in android.

http://developer.android.com/guide/topics/graphics/2d-graphics.html#nine-patch

It helps understanding how to edit them.

It reminds me of the Scale9 method in actionscript (sorry, I used to be a web developer and actionscripter so I try and relate new code and methods to what I already know to understand them better).
 

Mccaula718

New member
Jun 4, 2011
3
0
0
Maryland
So i googled how to theme Gingerblur and got the link you posted. I then became a member of this site for some clarification on the instructions and upon searching, i found this post which is pretty sweet. Anyways, back to the question.

I understand all the commands, seem pretty simple, except for step 2. Is this the actual theme file you're referring to? If so are there any restrictions to what theme I can use, or do only certain ones work with this rom?

Thanks in advance!