Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,728,773 Members 52,776 Now Online
XDA Developers Android and Mobile Development Forum

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

Tip us?
 
he_stheone64
Old
(Last edited by he_stheone64; 1st October 2012 at 02:23 PM.)
#1  
he_stheone64's Avatar
Recognized Contributor / Themer - OP
Thanks Meter 10774
Posts: 4,981
Join Date: Aug 2008
Location: Vienna & Düsseldorf
Default [How-To] FIX various compile errors with common Sense 4.0 files -Update apktool 1.4.9

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
The Following 39 Users Say Thank You to he_stheone64 For This Useful Post: [ Click to Expand ]
 
he_stheone64
Old
#2  
he_stheone64's Avatar
Recognized Contributor / Themer - OP
Thanks Meter 10774
Posts: 4,981
Join Date: Aug 2008
Location: Vienna & Düsseldorf
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: [ Click to Expand ]
 
he_stheone64
Old
#3  
he_stheone64's Avatar
Recognized Contributor / Themer - OP
Thanks Meter 10774
Posts: 4,981
Join Date: Aug 2008
Location: Vienna & Düsseldorf
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: [ Click to Expand ]
 
itsmikeramsay
Old
#4  
itsmikeramsay's Avatar
Recognized Themer
Thanks Meter 11228
Posts: 4,931
Join Date: Mar 2009
Location: Atlanta

 
DONATE TO ME
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

Note 3 powered by Tweaked ROM & ColonelXB maxed at 2.8GHz

Hit the Thanks! Button If I've Helped!
Donations are ALWAYS appreciated!


Twitter: @ItsMikeRamsay
The Following User Says Thank You to itsmikeramsay For This Useful Post: [ Click to Expand ]
 
he_stheone64
Old
#5  
he_stheone64's Avatar
Recognized Contributor / Themer - OP
Thanks Meter 10774
Posts: 4,981
Join Date: Aug 2008
Location: Vienna & Düsseldorf
You can PM chrisch1974 from Virtuous team, he is already working on this. Maybe your combined efforts help.
 
he_stheone64
Old
#6  
he_stheone64's Avatar
Recognized Contributor / Themer - OP
Thanks Meter 10774
Posts: 4,981
Join Date: Aug 2008
Location: Vienna & Düsseldorf
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: [ Click to Expand ]
 
memnoc
Old
#7  
memnoc's Avatar
Recognized Developer
Thanks Meter 4843
Posts: 4,198
Join Date: Feb 2011

 
DONATE TO ME
Quote:
Originally Posted by he_stheone64 View Post
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

 
he_stheone64
Old
#8  
he_stheone64's Avatar
Recognized Contributor / Themer - OP
Thanks Meter 10774
Posts: 4,981
Join Date: Aug 2008
Location: Vienna & Düsseldorf
no problem old DHD buddy, just go ahead.
 
fritzhy
Old
(Last edited by fritzhy; 16th May 2012 at 12:48 PM.)
#9  
Senior Member
Thanks Meter 298
Posts: 246
Join Date: Nov 2011
Location: Stockholm

 
DONATE TO ME
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?
 
he_stheone64
Old
#10  
he_stheone64's Avatar
Recognized Contributor / Themer - OP
Thanks Meter 10774
Posts: 4,981
Join Date: Aug 2008
Location: Vienna & Düsseldorf
I tried HTCContacts and resources like colors and styles are fine, it did not break anything on the phone.

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes