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

Search This thread

iBotPeaches

Recognized Developer
Apr 8, 2011
951
4,500
Tampa
connortumbleson.com
I've actually been working on fixing apktool for about a month. That nasty plurals error is fixed and the error where it reverses the attributes of the XML is still in progress.

I've tried to contact brut.all various times for help on updating his tool, but he seems to be missing. If anyone else has some extensive knowledge in apk decompiling contact me, so we can work towards a community product that doesn't mess up XMLs for ICS.
 
  • Like
Reactions: mike1986.

fernando sor

Inactive Recognized Themer
Sep 7, 2010
9,744
5,640
12
north of the wall
I've actually been working on fixing apktool for about a month. That nasty plurals error is fixed and the error where it reverses the attributes of the XML is still in progress.

I've tried to contact brut.all various times for help on updating his tool, but he seems to be missing. If anyone else has some extensive knowledge in apk decompiling contact me, so we can work towards a community product that doesn't mess up XMLs for ICS.

At least there is a fix. I have been working on apktool to decompile com.htc.resources and the dimens hdpi and xdpi errors make it impossible to decompile even the image folders. I have tried updating some of the files in apktool with no success

Sent from my ADR6425LVW using xda premium
 

tommytomatoe

Inactive Recognized Developer
Dec 13, 2010
6,282
6,800
34
Knoxville USA
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 :)
 

dmeadows013

Inactive Recognized Developer
Sep 27, 2010
2,491
3,791
Hoboken, NJ
epicandroidroms.blogspot.com
Is there any fix to decompile SystemUI? Haven't tried with 4.0 but 3.6 errors me on apktools 1.4.1, 1.4.2, and 1.4.3.

Code:
dmeadows013$ apktool d SystemUI.apk
I: Baksmaling...
I: Loading resource table...
Exception in thread "main" brut.androlib.AndrolibException: Multiple resources: spec=0x7f0a000e dimen/status_bar_icon_drawing_size, config=-v13
	at brut.androlib.res.data.ResConfig.addResource(ResConfig.java:65)
	at brut.androlib.res.data.ResConfig.addResource(ResConfig.java:58)
	at brut.androlib.res.decoder.ARSCDecoder.readEntry(ARSCDecoder.java:196)
	at brut.androlib.res.decoder.ARSCDecoder.readConfig(ARSCDecoder.java:165)
	at brut.androlib.res.decoder.ARSCDecoder.readType(ARSCDecoder.java:130)
	at brut.androlib.res.decoder.ARSCDecoder.readPackage(ARSCDecoder.java:105)
	at brut.androlib.res.decoder.ARSCDecoder.readTable(ARSCDecoder.java:82)
	at brut.androlib.res.decoder.ARSCDecoder.decode(ARSCDecoder.java:48)
	at brut.androlib.res.AndrolibResources.getResPackagesFromApk(AndrolibResources.java:315)
	at brut.androlib.res.AndrolibResources.loadMainPkg(AndrolibResources.java:50)
	at brut.androlib.res.AndrolibResources.getResTable(AndrolibResources.java:43)
	at brut.androlib.Androlib.getResTable(Androlib.java:44)
	at brut.androlib.ApkDecoder.getResTable(ApkDecoder.java:148)
	at brut.androlib.ApkDecoder.decode(ApkDecoder.java:98)
	at brut.apktool.Main.cmdDecode(Main.java:120)
	at brut.apktool.Main.main(Main.java:57)
 

fernando sor

Inactive Recognized Themer
Sep 7, 2010
9,744
5,640
12
north of the wall
Is there any fix to decompile SystemUI? Haven't tried with 4.0 but 3.6 errors me on apktools 1.4.1, 1.4.2, and 1.4.3.

Code:
dmeadows013$ apktool d SystemUI.apk
I: Baksmaling...
I: Loading resource table...
Exception in thread "main" brut.androlib.AndrolibException: Multiple resources: spec=0x7f0a000e dimen/status_bar_icon_drawing_size, config=-v13
	at brut.androlib.res.data.ResConfig.addResource(ResConfig.java:65)
	at brut.androlib.res.data.ResConfig.addResource(ResConfig.java:58)
	at brut.androlib.res.decoder.ARSCDecoder.readEntry(ARSCDecoder.java:196)
	at brut.androlib.res.decoder.ARSCDecoder.readConfig(ARSCDecoder.java:165)
	at brut.androlib.res.decoder.ARSCDecoder.readType(ARSCDecoder.java:130)
	at brut.androlib.res.decoder.ARSCDecoder.readPackage(ARSCDecoder.java:105)
	at brut.androlib.res.decoder.ARSCDecoder.readTable(ARSCDecoder.java:82)
	at brut.androlib.res.decoder.ARSCDecoder.decode(ARSCDecoder.java:48)
	at brut.androlib.res.AndrolibResources.getResPackagesFromApk(AndrolibResources.java:315)
	at brut.androlib.res.AndrolibResources.loadMainPkg(AndrolibResources.java:50)
	at brut.androlib.res.AndrolibResources.getResTable(AndrolibResources.java:43)
	at brut.androlib.Androlib.getResTable(Androlib.java:44)
	at brut.androlib.ApkDecoder.getResTable(ApkDecoder.java:148)
	at brut.androlib.ApkDecoder.decode(ApkDecoder.java:98)
	at brut.apktool.Main.cmdDecode(Main.java:120)
	at brut.apktool.Main.main(Main.java:57)

Use the apktool i posted. I updated the Smali and baksmali properties in it. I've used it for sense 3.6 systemui many times.
Closer look tho i see your getting past baksmaling. If you want post your systemui. It could be your aapt

Sent from my ADR6425LVW using xda premium
 
Last edited:
  • Like
Reactions: craigtut

dmeadows013

Inactive Recognized Developer
Sep 27, 2010
2,491
3,791
Hoboken, NJ
epicandroidroms.blogspot.com
Use the apktool i posted. I updated the Smali and baksmali properties in it. I've use it in 3.6 systemui many times.
Closer look tho i see your getting past baksmaling. If you want post your systemui. It could be your aapt

Sent from my ADR6425LVW using xda premium

Something tells me it is... Should I use the aapt from the newest apktool? Or from something else?
 

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