[Android Software Development] varun.chitre15:
I have got a bunch of errors while compiling Contacts.apk from a Samsung ROM

Before posting I have ensured following things

1. I have IF'ed the framework, and I think this is not necessary while compiling the apk right?

2. I am using latest APKTool and aapt

3. APK is not ever decompiled by any old apktool. It is freshly taken from Samsung fresh stock ROM

4. To be more accurate I have only decompiled it and compiled back without any changes and got the error

Here is error log of compilation of Contacts.apk

java version "1.7.0_06"
Java(TM) SE Runtime Environment (build 1.7.0_06-b24)
Java HotSpot(TM) 64-Bit Server VM (build 23.2-b09, mixed mode)
I: Checking whether sources has changed...
I: Smaling...
I: Checking whether resources has changed...
I: Building resources...
D:\Jet_ROMs\APK Manager A9\other\..\projects\Contacts.apk\res\values\arrays.xml:27: error: Found tag reference-array where item is expected
D:\Jet_ROMs\APK Manager A9\other\..\projects\Contacts.apk\res\values\public.xml:1517: error: Public symbol array/config_dialerKeyVibePattern declared here is not defined.
D:\Jet_ROMs\APK Manager A9\other\..\projects\Contacts.apk\res\values\public.xml:1520: error: Public entry identifier 0x7f06000e entry index is larger than available symbols (index 14, total symbols 8).
D:\Jet_ROMs\APK Manager A9\other\..\projects\Contacts.apk\res\values\public.xml:1520: error: Public symbol array/day_of_week declared here is not defined.
D:\Jet_ROMs\APK Manager A9\other\..\projects\Contacts.apk\res\values\public.xml:1521: error: Public symbol array/mail_via_list declared here is not defined.
D:\Jet_ROMs\APK Manager A9\other\..\projects\Contacts.apk\res\values\public.xml:1523: error: Public entry identifier 0x7f060011 entry index is larger than available symbols (index 17, total symbols 8).
D:\Jet_ROMs\APK Manager A9\other\..\projects\Contacts.apk\res\values\public.xml:1523: error: Public symbol array/otherLabels declared here is not defined.
D:\Jet_ROMs\APK Manager A9\other\..\projects\Contacts.apk\res\values\public.xml:1516: error: Public symbol array/saveto_items declared here is not defined.
D:\Jet_ROMs\APK Manager A9\other\..\projects\Contacts.apk\res\values\public.xml:1522: error: Public entry identifier 0x7f060010 entry index is larger than available symbols (index 16, total symbols 8).
D:\Jet_ROMs\APK Manager A9\other\..\projects\Contacts.apk\res\values\public.xml:1522: error: Public symbol array/service_providers declared here is not defined.
D:\Jet_ROMs\APK Manager A9\other\..\projects\Contacts.apk\res\values\public.xml:1513: error: Public symbol array/sweet_call_image_h declared here is not defined.
D:\Jet_ROMs\APK Manager A9\other\..\projects\Contacts.apk\res\values\public.xml:1511: error: Public symbol array/sweet_call_image_p declared here is not defined.
D:\Jet_ROMs\APK Manager A9\other\..\projects\Contacts.apk\res\values\public.xml:1514: error: Public symbol array/sweet_msg_image_h declared here is not defined.
D:\Jet_ROMs\APK Manager A9\other\..\projects\Contacts.apk\res\values\public.xml:1512: error: Public symbol array/sweet_msg_image_p declared here is not defined.
D:\Jet_ROMs\APK Manager A9\other\..\projects\Contacts.apk\res\values\public.xml:1515: error: Public symbol array/viewby_items declared here is not defined.
D:\Jet_ROMs\APK Manager A9\other\..\projects\Contacts.apk\res\values\public.xml:1519: error: Public symbol array/viewby_items_kor declared here is not defined.
D:\Jet_ROMs\APK Manager A9\other\..\projects\Contacts.apk\res\values\public.xml:1518: error: Public symbol array/viewby_items_with_voip declared here is not defined.
Exception in thread "main" brut.androlib.AndrolibException: brut.common.BrutException: could not exec command: [aapt, p, --min-sdk-version, 10, --target-sdk-version, 10, -F, C:\Users\Varun\AppData\Local\Temp\APKTOOL4021600008148927279.tmp, -I, C:\Users\Varun\apktool\framework\1.apk, -I, C:\Users\Varun\apktool\framework\2.apk, -S, D:\Jet_ROMs\APK Manager A9\other\..\projects\Contacts.apk\res, -M, D:\Jet_ROMs\APK Manager A9\other\..\projects\Contacts.apk\AndroidManifest.xml]
at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:255)
at brut.androlib.Androlib.buildResourcesFull(Androlib.java:324)
at brut.androlib.Androlib.buildResources(Androlib.java:269)
at brut.androlib.Androlib.build(Androlib.java:192)
at brut.androlib.Androlib.build(Androlib.java:174)
at brut.apktool.Main.cmdBuild(Main.java:188)
at brut.apktool.Main.main(Main.java:70)
Caused by: brut.common.BrutException: could not exec command: [aapt, p, --min-sdk-version, 10, --target-sdk-version, 10, -F, C:\Users\Varun\AppData\Local\Temp\APKTOOL4021600008148927279.tmp, -I, C:\Users\Varun\apktool\framework\1.apk, -I, C:\Users\Varun\apktool\framework\2.apk, -S, D:\Jet_ROMs\APK Manager A9\other\..\projects\Contacts.apk\res, -M, D:\Jet_ROMs\APK Manager A9\other\..\projects\Contacts.apk\AndroidManifest.xml]
at brut.util.OS.exec(OS.java:83)
at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:253)
... 6 more

In error log we can see many errors of public.xml, so what I did is completely erased public.xml and tried recompiling so that those hex codes get re-generated freshly and magic was all public.xml errors went away but arrays.xml error persisted

But I doubt that workaround of public.xml is not good because it is saying those arrays are not defined. how is that possible? then how did samsung got it compiled because whenever anything is declared in public.xml and if it is not defined then compile won't be successful, Am I right?

Do I need to attach apk and framework or is there any handy solution?

Thank you :)