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

Search This thread

Rainbowbright081

Senior Member
Mar 20, 2011
264
47
Indiana
It'snot so much the decompile problems I have its the recompiling that is getting me.

I get tagging the framework, but I'm a bit of a noob when it comes to using those tags.

Would I need to install systemui in with framework and HTC.resources?

Lots of questions. Thank you

Edit: I will try your apktool tonight.

Sent from my HTC Sensation 4G using Tapatalk 2
 
Last edited:

rayford85

Senior Member
May 22, 2011
4,263
5,279
It'snot so much the decompile problems I have its the recompiling that is getting me.

I get tagging the framework, but I'm a bit of a noob when it comes to using those tags.

Would I need to install systemui in with framework and HTC.resources?

Lots of questions. Thank you

Sent from my HTC Sensation 4G using Tapatalk 2

If your not touching smali, type apktool d -s (path to your apk). It will copy class.dex instead of decompiling. Avoiding bad magic errors. But as long as the proper resources are installed. You shouldnt have a problem. Now the public errors can happen for different reasons. For instance. Say your adding animated signal icons. To systemui. You mod the required xml's, add your animated icons, and delete the stock icons. If you don't delete there public id as well it will throw errors. Remember that public will build new id's if needed so your ok to just delete the ones that throw errors. They will build back in the end.

Sent from my HTC One X using xda premium
 

Rainbowbright081

Senior Member
Mar 20, 2011
264
47
Indiana
All I was editing was .9 and .png. wasn't adding or subtracting.

Another thing I noticed all my pngs weren't showing up in the decompile.

Rayford I will try your method this evening as well.


Edit: no xml or smali edits, I wanna get better with the compiling before I mess with those.

Sent from my HTC Sensation 4G using Tapatalk 2
 

fernando sor

Inactive Recognized Themer
Sep 7, 2010
9,744
5,640
12
north of the wall
Really need to see what errors your getting on recompile. If you bork one image you will get an error for every image after that

Sent from my ADR6425LVW using xda premium
 

Rainbowbright081

Senior Member
Mar 20, 2011
264
47
Indiana
I have 2 I images when decompiling get borked, I just don't know where to put the edges back in at.

Sent from my HTC Sensation 4G using Tapatalk 2
 

fernando sor

Inactive Recognized Themer
Sep 7, 2010
9,744
5,640
12
north of the wall
I have 2 I images when decompiling get borked, I just don't know where to put the edges back in at.

Sent from my HTC Sensation 4G using Tapatalk 2

Put them in draw9patch and check show bad patches. Then put one black chunk in the middle on the left side and one in the middle of the top.
Then draw a black line down the right side and one line all the way along the bottom and then save it. Then recompile

Sent from my ADR6425LVW using xda premium
 
  • Like
Reactions: Rainbowbright081

fisha21

Senior Member
Nov 23, 2007
2,331
4,379
I would decompile and mod ics sense 3.6 com.htc.resources from the rezound. Same xdpi folder. Im sure they are similar and You could probably use a lot of the images.


Thanks for the advice. Tried using the apk from Sense 3.6 as suggested, but they are very different!


If you're adding them to a different apk that doesn't already have those images you will need to rename them to something already in the apk and replace. Otherwise they aren't defined and wont decompile.

I used the resources from the Htc Flyer since it's pretty similar but I would try Fernando's method first, unless you enjoy renaming pngs :p


Ended up having to rename and replace as you suggested...not fun at all! Can't wait for an updated version of apktool!
 

Rainbowbright081

Senior Member
Mar 20, 2011
264
47
Indiana
Hot diggity dog! fern, thanks so much! Your apktool, fixing the 3, thats right 3, .9 images that needed fixed, thanks to your instruction :), this problem recompiling my Systemui apk is finally fixed.

Again, thank you
 
  • Like
Reactions: fernando sor

Smokem_I

Senior Member
Nov 24, 2010
2,398
1,777
Peoria
Awesome fern! Just grabbed the Apktool and will hopefully be able to accomplish something on my One S! Gonna have to stop by the reference thread for some guidance on themeing Sense 4.0. I'm so used to CM7 theme engine lol. I'll definitely need some help from your team! Thanks and keep the knowledge flowing!

Sent from my HTC VLE_U using Tapatalk 2
 
  • Like
Reactions: fernando sor

Rainbowbright081

Senior Member
Mar 20, 2011
264
47
Indiana
Smoke finally an upgrade for ya! If I can help u I will, after all, u were the first to offer me some help :)

Sent from my HTC Sensation 4G using Tapatalk 2
 

he_stheone64

Senior Member
Aug 1, 2008
5,033
10,991
Düsseldorf
Hi Fernando - I accidentally stumbled about this thread (I have a One S, no X...). I never had issues with compiling framework, since I used a modded apktool version from day 1 (I used that already on Galaxy Nexus), which compiles plurals just fine.

Initially I also had some issue with com.htc.resources, but could solve these fairly quick. Since I`m sure One X com.htc. is fairly similar to One S, maybe my fix can help you guys too.

This was the original error log

PHP:
C:\apk_manager_5.0\other\..\projects\com.htc.resources.apk\res\values\layouts.xml:3: error: Found tag layout where item is expected
C:\apk_manager_5.0\other\..\projects\com.htc.resources.apk\res\values\public.xml:1975: error: Public entry identifier 0x2050209 entry index is larger than available symbols (index 521, total symbols 521).
C:\apk_manager_5.0\other\..\projects\com.htc.resources.apk\res\values\public.xml:1975: error: Public symbol dimen/zero_dummy_dimen declared here is not defined.

This is how I solved it:

Step 1: Fixing layout tags in layouts.xml

I replaced all tags with:

<item type="layout" at the front and </item> at the end

PHP:
<resources>
    <item type="layout" name="htc_list_item_imageicon_text">@layout/zzzz_htc_list_item_imageicon_text</item>
    <item type="layout" name="pin_keyboard">@layout/zzzz_pin_keyboard</item>
    <item type="layout" name="zero_dummy_layout">@layout/alert_dialog</item>
    <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_separator">@layout/zzzz_htc_list_item_separator</item>
    <item type="layout" name="htc_list_item_dlna_1">false</item>
</resources>

Step 2: Fixing public.xml error

Here I simply deleted the entry, since apktool is rebuilding that just fine

Hope that helps you guys here also with your issues.
 
Last edited:

fernando sor

Inactive Recognized Themer
Sep 7, 2010
9,744
5,640
12
north of the wall
Hi Fernando - I accidentally stumbled about this thread (I have a One S, no X...). I never had issues with compiling framework, since I used a modded apktool version from day 1 (I used that already on Galaxy Nexus), which compiles plurals just fine.

Initially I also had some issue with com.htc.resources, but could solve these fairly quick. Since I`m sure One X com.htc. is fairly similar to One S, maybe my fix can help you guys too.

This was the original error log

PHP:
C:\apk_manager_5.0\other\..\projects\com.htc.resources.apk\res\values\layouts.xml:3: error: Found tag layout where item is expected
C:\apk_manager_5.0\other\..\projects\com.htc.resources.apk\res\values\public.xml:1975: error: Public entry identifier 0x2050209 entry index is larger than available symbols (index 521, total symbols 521).
C:\apk_manager_5.0\other\..\projects\com.htc.resources.apk\res\values\public.xml:1975: error: Public symbol dimen/zero_dummy_dimen declared here is not defined.

This is how I solved it:

Step 1: Fixing layout tags in layouts.xml

I replaced all tags with:

<item type="layout" at the front and </item> at the end

PHP:
<resources>
    <item type="layout" name="htc_list_item_imageicon_text">@layout/zzzz_htc_list_item_imageicon_text</item>
    <item type="layout" name="pin_keyboard">@layout/zzzz_pin_keyboard</item>
    <item type="layout" name="zero_dummy_layout">@layout/alert_dialog</item>
    <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_separator">@layout/zzzz_htc_list_item_separator</item>
    <item type="layout" name="htc_list_item_dlna_1">false</item>
</resources>

Step 2: Fixing public.xml error

Here I simply deleted the entry, since apktool is rebuilding that just fine

Hope that helps you guys here also with your issues.

Hey good to hear from you bro.
How are you even getting sense 4.0 com.htc.resources to decompile? I just get an empty folder

Sent from my ADR6425LVW using xda premium
 

he_stheone64

Senior Member
Aug 1, 2008
5,033
10,991
Düsseldorf
Can you send me the X com.htc? Then I can double check, whether I can also fix it. Maybe apktool creates other issues with the added xhdpi folders, but I can check that if you send me the stock file.

Send from my One S
 

fernando sor

Inactive Recognized Themer
Sep 7, 2010
9,744
5,640
12
north of the wall
The only one I've tried is a leak for the rezound which does have the xdpi folders. I'll send it to you thanks

Sent from my ADR6425LVW using xda premium
 

he_stheone64

Senior Member
Aug 1, 2008
5,033
10,991
Düsseldorf
Thx and received - decompiled successfully, fixed all issues and now waiting to compile...

TOUCHDOWN :D

I will upload the apk later, I randomly changed a few color values to ICS blue, so you`ll see it worked all fine. System seems to work for all Sense 4.0 ICS com.htc.resources

1. Fix Layoits.xml as described
2. Delete zero_dummy_dimen in public.xml

I will check later with stock com.htc.resources from One X, but I`m very confident I will see the same result ;)


If only someone could fix bloody m.10`s - that is the sole reason I focus on mods atm, not on full Themes, since without having access to m.10 files Themes will not have the quality I need. Good news is, Sense 4.0 is visually so much better, then old versions.


Edit: Here`s a new thread, that addresses this and more fixes

http://xdaforums.com/showthread.php?p=25817188#post25817188
 
Last edited:

fisha21

Senior Member
Nov 23, 2007
2,331
4,379
I will check later with stock com.htc.resources from One X, but I`m very confident I will see the same result ;)

Not sure if you have a copy of the stock One X file, so have uploaded it here: https://www.box.com/shared/f9302a6bc63869ca0d52. Would be great if you can get it working...at the moment, any attempt to decompile results in an empty folder, so there are no xmls to fix!


If only someone could fix bloody m.10`s - that is the sole reason I focus on mods atm, not on full Themes, since without having access to m.10 files Themes will not have the quality I need. Good news is, Sense 4.0 is visually so much better, then old versions.

I've found that editing one of the stock HTC skins lets you get around a lot of the limitations.

What I did find inetersting is that changing HTC skins allows you to change clock widget colour, lockscreen ring, homescreen dock etc without needing to edit m10 files. But if I change the relevant pngs in my skin, they then don't get applied. Any ideas how to fix this?

Sent from my HTC One X using xda premium
 

he_stheone64

Senior Member
Aug 1, 2008
5,033
10,991
Düsseldorf
I also finished a Skin for One s weeks ago, but there are too many parts, that are still overwritten by m.10 files. Certainly you can address a lot of areas, but I don`t like half baken Themes, so I decided not to publish the Skin and Theme, that is basically ready.

Edit: You are right - the file fernando has send me from Rezound worked perfect with my fix, as it did on One S. Your One X file already creates issues during decompile, which will be tough... So my fix was nice for One S and also great for fernando`s rezound issues, but we`re still not there for One X. I will see, whether I find a creative solution.
 
Last edited:
  • Like
Reactions: fisha21

Scabes24

Inactive Recognized Themer
Aug 24, 2008
2,498
876
Seattle, WA
Thx and received - decompiled successfully, fixed all issues and now waiting to compile...

TOUCHDOWN :D

I will upload the apk later, I randomly changed a few color values to ICS blue, so you`ll see it worked all fine. System seems to work for all Sense 4.0 ICS com.htc.resources

1. Fix Layoits.xml as described
2. Delete zero_dummy_dimen in public.xml

I will check later with stock com.htc.resources from One X, but I`m very confident I will see the same result ;)


If only someone could fix bloody m.10`s - that is the sole reason I focus on mods atm, not on full Themes, since without having access to m.10 files Themes will not have the quality I need. Good news is, Sense 4.0 is visually so much better, then old versions.

You sir are the man! :)

And I completely agree about the m10 problem. A full theme can't be complete without being able to modify the core of Sense UI.


Sent from my HTC One X
 

Top Liked Posts

  • There are no posts matching your filters.
  • 44
    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
    3
    Very nice tutorial Fern, I'll be coming along as well. I like seeing some of the names in here, very comforting knowing there will be some really good devs on the ONE X. Look forward to some of the new stuff I can learn.
    2
    Can you send me the X com.htc? Then I can double check, whether I can also fix it. Maybe apktool creates other issues with the added xhdpi folders, but I can check that if you send me the stock file.

    Send from my One S
    2
    Great job ferno!!!!

    That sucks. One of our guys themed resources image by image running them all thru draw 9 patch tool One by one :eek::eek:

    I felt sorry for him :p

    Sent from my HTC One X using XDA

    Well I wouldn't say all of them, but quite a few :p

    I was able to add a lot of them to a different resources.apk and decompile.

    Sent from my HTC Flyer.

    I was just about to say do just that. lol. Throw the 9.png in a decodable resource.apk (or any apk for that matter) and decode. There is also a handy Mac and Linux tool for decoding 9.png :)
    2
    Thx and received - decompiled successfully, fixed all issues and now waiting to compile...

    TOUCHDOWN :D

    I will upload the apk later, I randomly changed a few color values to ICS blue, so you`ll see it worked all fine. System seems to work for all Sense 4.0 ICS com.htc.resources

    1. Fix Layoits.xml as described
    2. Delete zero_dummy_dimen in public.xml

    I will check later with stock com.htc.resources from One X, but I`m very confident I will see the same result ;)


    If only someone could fix bloody m.10`s - that is the sole reason I focus on mods atm, not on full Themes, since without having access to m.10 files Themes will not have the quality I need. Good news is, Sense 4.0 is visually so much better, then old versions.


    Edit: Here`s a new thread, that addresses this and more fixes

    http://xdaforums.com/showthread.php?p=25817188#post25817188