Thursday 7 June 2012

How to Fix the Compile Issue and Fatal errors with Sense 4.0 ROM file



ICS brought many changes and development in the Google OS. This may frustrate many users because they need to modify and changes the FILE such APK and APK Manager. Sense 4 is the main cause for the compilation errors associated with file modification in APK tools and APK Manager.


The most three important files framework-res.apk, com.htc.resources.apk and systemui.apk  all create these errors 

Here is the fix

 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 - Download

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

0 Responses to “How to Fix the Compile Issue and Fatal errors with Sense 4.0 ROM file”

Post a Comment