5,601,223 Members 53,118 Now Online
XDA Developers Android and Mobile Development Forum

[tutorial]**Fix for recompiling framework-res with apktool** 4/15/2012

Tip us?
 
fernando sor
Old
(Last edited by fernando sor; 9th September 2013 at 05:39 AM.)
#1  
fernando sor's Avatar
Recognized Themer - OP
Thanks Meter 4807
Posts: 9,226
Join Date: Sep 2010
Location: north of the wall
Default [tutorial]**Fix for recompiling framework-res with apktool** 4/15/2012

Greetings

i do not have have a one x but i have come up with a solution for the errors in apktool when recompiling framework-res.

i have a rezound and have run sense 4.0 on my phone. the screen res is also very similar to the one x.

there are four xmls in values that need to be rewritten.

anims.xml
layout.xml
a small change in plurals.xml
and raw.xml

the change made in plurals has to be made in all the foreign language plurals if you want to keep the languages. you can however delete them if you like. the framework i am posting has the plurals fixed for all languages though.

i am posting also my version of apktool which i have modified to properly smali htc apks.

to begin.

download the apktool linked here
unzip and place the folder wherever you want on your computer.
pull framework-res.apk and com.htc.resources.apk from your rom and place in the apktool folder

open a command window to apktool. (right click on your apktool folder and hit shift at the same time. one of the options will be to open a command window.)

type apktool if framework-res.apk hit enter
then type apktool if com.htc.resources.apk hit enter

now your needed dependencies are installed.

type apktool d framework-res.apk framework hit enter.

note im naming the out folder framework. you can name it anything you like.

this will create a decompiled framework-res. i named the folder framework so there will be a framework folder in your apktool folder now.

go to res/values anims.xml

change this

<anim name="htc_ime_decelerate_interpolator">@anim/zzz_htc_ime_decelerate_interpolator</anim>

to this

<item type="anim" name="htc_ime_decelerate_interpolator">@anim/zzz_htc_ime_decelerate_interpolator</item>

go to res/values layout.xml

change this

Code:
<layout name="htc_list_item_2text_2stamp">@layout/zzzz_htc_list_item_2text_2stamp</layout>
    <layout name="htc_list_item_2text_bright">@layout/zzzz_htc_list_item_2text_bright</layout>
    <layout name="htc_list_item_image_2text_image_bright">@layout/zzzz_htc_list_item_image_2text_image_bright</layout>
    <layout name="htc_list_item_imageicon_2text_2stamp">@layout/zzzz_htc_list_item_imageicon_2text_2stamp</layout>
    <layout name="htc_list_item_imageicon_text">@layout/zzzz_htc_list_item_imageicon_text</layout>
    <layout name="htc_list_item_separator">@layout/zzzz_htc_list_item_separator</layout>
    <layout name="keyguard_screen_device_unlock">@layout/zzzz_keyguard_screen_device_unlock</layout>
    <layout name="pin_keyboard">@layout/zzzz_pin_keyboard</layout>

to this


Code:
<item type="layout" name="htc_list_item_2text_2stamp">@layout/zzzz_htc_list_item_2text_2stamp</item>
    <item type="layout" name="htc_list_item_2text_bright">@layout/zzzz_htc_list_item_2text_bright</item>
    <item type="layout" name="htc_list_item_image_2text_image_bright">@layout/zzzz_htc_list_item_image_2text_image_bright</item>
    <item type="layout" name="htc_list_item_imageicon_2text_2stamp">@layout/zzzz_htc_list_item_imageicon_2text_2stamp</item>
    <item type="layout" name="htc_list_item_imageicon_text">@layout/zzzz_htc_list_item_imageicon_text</item>
    <item type="layout" name="htc_list_item_separator">@layout/zzzz_htc_list_item_separator</item>
    <item type="layout" name="keyguard_screen_device_unlock">@layout/zzzz_keyguard_screen_device_unlock</item>
    <item type="layout" name="pin_keyboard">@layout/zzzz_pin_keyboard</item>
go to res/values plurals.xml

go to line 79

change this

%d of %d

to this

%1$d of %2$d

now remember every foreign language plural needs that change or just delete them.

go to res/values raws.xml

change this

<raw name="fallbackring_htc">@raw/zzzz_fallbackring_htc</raw>

to this

<item type="raw" name="fallbackring_htc">@raw/zzzz_fallbackring_htc</item>

now when all of the plurals are changed or deleted ( do NOT delete the plurals in res/values. that has to be changed.)
type apktool b framework hit enter. this will build your apk.

here are the res/values xmls modded already to make this easy.

download here replace the existing decompiled xmls with these.

now when you decompile to make further changes you will find that three of the xmls

anims.xml
layout.xml
raws.xml
compile back to their original format so save the modified decompiled xmls

this is the modified framework

framework-res

please post any issues
The Following 43 Users Say Thank You to fernando sor For This Useful Post: [ Click to Expand ]
 
leventccc
Old
#2  
Senior Member
Thanks Meter 428
Posts: 776
Join Date: Jan 2011
Location: Istanbul
For compile I'm using apktool b <directory>. I got http://pastebin.com/quWsK7mP
Nexus 4| Nexus 7 | HTC One
HTC Hero > Samsung Galaxy S > HTC One X > Nokia Lumia 920>HTC One X+> Nexus 4 + HTC One
[/CENTER]
The Following User Says Thank You to leventccc For This Useful Post: [ Click to Expand ]
 
fernando sor
Old
#3  
fernando sor's Avatar
Recognized Themer - OP
Thanks Meter 4807
Posts: 9,226
Join Date: Sep 2010
Location: north of the wall
i just finished the tutorial which addresses those errors
Bad seed Customs Founder



The Following User Says Thank You to fernando sor For This Useful Post: [ Click to Expand ]
 
rayford85
Old
#4  
rayford85's Avatar
Recognized Themer
Thanks Meter 4746
Posts: 4,133
Join Date: May 2011

 
DONATE TO ME
Nice to see you here Fern I did the same as your guide yesterday. Very simple fix. Now if we can solve resources....
The Following User Says Thank You to rayford85 For This Useful Post: [ Click to Expand ]
 
fernando sor
Old
#5  
fernando sor's Avatar
Recognized Themer - OP
Thanks Meter 4807
Posts: 9,226
Join Date: Sep 2010
Location: north of the wall
Quote:
Originally Posted by rayford85 View Post
Nice to see you here Fern I did the same as your guide yesterday. Very simple fix. Now if we can solve resources....
i believe it is along the same lines. ill take a look at it
Bad seed Customs Founder



 
leventccc
Old
#6  
Senior Member
Thanks Meter 428
Posts: 776
Join Date: Jan 2011
Location: Istanbul
Quote:
Originally Posted by fernando sor View Post
i just finished the tutorial which addresses those errors
Thanks now trying it
Nexus 4| Nexus 7 | HTC One
HTC Hero > Samsung Galaxy S > HTC One X > Nokia Lumia 920>HTC One X+> Nexus 4 + HTC One
[/CENTER]
The Following User Says Thank You to leventccc For This Useful Post: [ Click to Expand ]
 
pstevep
Old
#7  
pstevep's Avatar
Senior Moderator / Developer Committee / XDA News Writer / Recognized Themer / IDGAF
Thanks Meter 5966
Posts: 5,410
Join Date: Aug 2010
Location: ????

 
DONATE TO ME
I need a place here.
The Following User Says Thank You to pstevep For This Useful Post: [ Click to Expand ]
 
Onepagebook
Old
#8  
Onepagebook's Avatar
Recognized Themer
Thanks Meter 2219
Posts: 1,856
Join Date: Dec 2010
Location: Land of Buckeye & Formosa

 
DONATE TO ME
Thanks very much for the heads up, good to see this fix
 
mike1986.
Old
#9  
mike1986.'s Avatar
Recognized Developer / Recognized Contributor
Thanks Meter 65776
Posts: 36,038
Join Date: Mar 2009
Location: XDA-Developers

 
DONATE TO ME
@fernando if you don't decompile .apk with -t then you don't need to install framework. To decompile framework-res.apk no dependencies are needed.


Archived devices and my other threads:

Join Android Revolution HD community

Facebook | Twitter | IRC chat | Visit my blog | Google+

If you appreciate my work, you can buy me a beer
Every donation is greatly appreciated and it helps the development!


 
LeeDroid
Old
#10  
LeeDroid's Avatar
Recognized Developer
Thanks Meter 11467
Posts: 12,449
Join Date: Jan 2007
Location: Darlington

 
DONATE TO ME
+1 ...

Been using this exact method since first deodexing the build.. htc-resources is unfortunately a very different story

Sent from my One Xtreme LeeDrOiD loaded Beast
Android Rom & Kernel Developer
HTC Desire, Desire HD, Sensation, EVO 3D, Flyer, One S & The One X
And yes.. I have them all, I only work on devices I can test on (perks of my job )

If you like my work and appreciate the 1000's of hours i have put in, please consider a small donation


Donate Via >> << Many Thanks

Please be aware, if you select the market option, Google take 30%


Follow me Twitter:@LeeDrOiD or LeeDrOiD ROMs on Facebook | To view my kernel source, visit @GitHub.com: LeeDroid-
Lee Bailey, Android ROM & Kernel developer!

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes