Post Reply

[How-To] FIX various compile errors with common Sense 4.0 files -Update apktool 1.4.9

8th May 2012, 08:19 AM   |  #1  
he_stheone64's Avatar
OP Recognized Contributor / Themer
Flag Vienna & Düsseldorf
Thanks Meter: 10,776
 
4,982 posts
Join Date:Joined: Aug 2008
More
This guide assumes you already know how to use apktool and / or apkmanager. If you don`t, there are plenty of guides already on XDA.

Latest Sense 4.0 and apktool are not great friends. The 3 most important files framework-res.apk, com.htc.resources.apk and systemui.apk all create fatal errors, when using latest apktool 1.43 version. Apktool`s error log is always a big help to solve compile issues, but you need a bit of compile and coding experience to finally solve these. After I stumbled about many people having Sense 4.0 compile issues, I decided to post this guide. Hopefully this will encourage more guys to add mods to One S, after they might have hit a wall before.

Credits:
  • brut for his awesome apktool
  • daneshm for original apkmanager

Known issues: ATM com.htc.resources fix does not work with One X


1. Framework-res.apk

a) Since ICS apktool creates multiple plurals errors, but you can easily fix these by using a custom version of apktool. Now updated incl. latest smali baksmali properties for ICS (thx fernando)

Custom ICS apktool version - http://minus.com/mIA3OFkYq/19

b) if you get tag errors like these

anims.xml:3: error: Found tag anim where item is expected
layouts.xml:3: error: Found tag layout where item is expected
raws.xml:3: error: Found tag raw where item is expected

Replace all tags in layouts.xml in values folder with:

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


Replace all tags in anims.xml in values folder with:

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


Replace all tags in raw.xml in values folder with:

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


2. Systemui.apk

When trying to decompile systemui, you will get bad magic value errors. Solution is to decompile without classes, as long as you don`t need to edit smali code. Even if you need to do that, you can still decompile classes.dex separately with smali baksmali.

a) Use -s switch when decompiling to copy classes.dex instead of decompiling it

java -jar apktool.jar d -s systemui.apk systemui-decoded

b) If you are using apkmanager, you can just export classes.dex, then delete classes inside the apk. Then decompile, edit, compile and add classes.dex back when ready.

EDIT: with updated apktool version systemui now compiles fine incl. classes.dex


3. com.htc.resources.apk

Here you get nice layouts tag errors and public entry issues. Again there`s an easy fix for that.

a) Replace all tags in layouts.xml in values folder with:

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

PHP Code:
<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
b) Delete entry "zero_dummy_dimen" in public.xml - it will be created correctly again during compile


In case you still have issues, here is my apkmanager build environment, that works fine with all these fixes.

http://minus.com/mIA3OFkYq/20


Hex editing solution for latest com.htc - thx to tbonanno231 - http://forum.xda-developers.com/show...&postcount=112


Latest apktool version 1.4.9 from ibotpeaches

Big thx to ibotpeaches for the tremendous follow up on apktool
  • Fixes plural errors
  • Fixes item tag errors
  • Fixes bad magic value errors
  • Adds ICS smali properties (compared to latest official version from brutall)
  • Fixes unknown folder issues (only with patched aapt.exe)

Download apktool 1.4.9:

http://sdrv.ms/T0LpzK


Download patched aapt.exe

http://sdrv.ms/Mfrkaa


c) Workaround for One X ROM´s

Since many of you guys might only be in need to decompile all the .9`s in com.htc.resources, there is a workaround that allows you to compile these.

Decompile with:

1. java -jar apktool.jar d --keep-broken-res com.htc.resources.apk com.htc.resources-decoded

This ignores all errors and decompiles the apk incl. all patched pngs.

2. Make your changes and copy the changed png`s in any given decompiled apk (I use calendarprovider.apk for this task, very slim apk, compiles fast...) and compile them
Last edited by he_stheone64; 1st October 2012 at 02:23 PM.
The Following 39 Users Say Thank You to he_stheone64 For This Useful Post: [ View ]
15th May 2012, 08:24 AM   |  #2  
he_stheone64's Avatar
OP Recognized Contributor / Themer
Flag Vienna & Düsseldorf
Thanks Meter: 10,776
 
4,982 posts
Join Date:Joined: Aug 2008
More
Updated with new custom apktool version, that includes latest smali baksmali properties to properly decompile ICS Java code.
The Following 7 Users Say Thank You to he_stheone64 For This Useful Post: [ View ]
15th May 2012, 04:39 PM   |  #3  
he_stheone64's Avatar
OP Recognized Contributor / Themer
Flag Vienna & Düsseldorf
Thanks Meter: 10,776
 
4,982 posts
Join Date:Joined: Aug 2008
More
Updated with new section b), that explains how to fix tag errors with latest 1.78 framework-res.apk
The Following 4 Users Say Thank You to he_stheone64 For This Useful Post: [ View ]
15th May 2012, 08:41 PM   |  #4  
itsmikeramsay's Avatar
Recognized Contributor
Flag Atlanta
Thanks Meter: 12,092
 
5,204 posts
Join Date:Joined: Mar 2009
Donate to Me
More
After trying this method.....it compiles framework-res 100% with absolutely NO issues. Thanks a million!!! I'm pretty sure everything else works....

Now I guess I'll try and work and see if I can find out how integrated in the framework WiFi calling is in the T-Mobile One S build in hopes we can get it working on any One S ROM, US or EU based....

Any ideas would help! lol
The Following User Says Thank You to itsmikeramsay For This Useful Post: [ View ]
16th May 2012, 07:47 AM   |  #5  
he_stheone64's Avatar
OP Recognized Contributor / Themer
Flag Vienna & Düsseldorf
Thanks Meter: 10,776
 
4,982 posts
Join Date:Joined: Aug 2008
More
You can PM chrisch1974 from Virtuous team, he is already working on this. Maybe your combined efforts help.
16th May 2012, 07:52 AM   |  #6  
he_stheone64's Avatar
OP Recognized Contributor / Themer
Flag Vienna & Düsseldorf
Thanks Meter: 10,776
 
4,982 posts
Join Date:Joined: Aug 2008
More
Updated apkmanager with latest apktool version that includes ICS smali properties
The Following 2 Users Say Thank You to he_stheone64 For This Useful Post: [ View ]
16th May 2012, 08:53 AM   |  #7  
memnoc's Avatar
Recognized Developer
Thanks Meter: 5,218
 
4,456 posts
Join Date:Joined: Feb 2011
Donate to Me
Quote:
Originally Posted by he_stheone64

Updated apkmanager with latest apktool version that includes ICS smali properties

Would be amazing integrate this tutorial with mine on vts!

Inviato dal mio HTC Sensation XE con Tapatalk 2
16th May 2012, 10:03 AM   |  #8  
he_stheone64's Avatar
OP Recognized Contributor / Themer
Flag Vienna & Düsseldorf
Thanks Meter: 10,776
 
4,982 posts
Join Date:Joined: Aug 2008
More
no problem old DHD buddy, just go ahead.
16th May 2012, 10:38 AM   |  #9  
Senior Member
Flag Stockholm
Thanks Meter: 299
 
246 posts
Join Date:Joined: Nov 2011
Donate to Me
More
Really appreciate this man! Exactly what I've been waiting for. The apktool.jar seems to be working fine, but the apk manager build environment won't compile .apks correctly for me. Is it supposed to be working straight out of the box?

Edit: Has anyone successfully edited colors.xml in Camera.apk without breaking the video recording function? Seems to be impossible for me.

Edit 2: Has anyone successfully edited colors.xml in Contacts.apk without breaking it?
Last edited by fritzhy; 16th May 2012 at 12:48 PM.
19th May 2012, 05:02 PM   |  #10  
he_stheone64's Avatar
OP Recognized Contributor / Themer
Flag Vienna & Düsseldorf
Thanks Meter: 10,776
 
4,982 posts
Join Date:Joined: Aug 2008
More
I tried HTCContacts and resources like colors and styles are fine, it did not break anything on the phone.

Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools
Display Modes


Top Threads in One S Android Development by ThreadRank