# [TOOL] Public.xml Helper



## roman (Jun 11, 2011)

Hey so I got kind of tired of adding in a battery mod for ever framework leak and such so I thought I could make it easier. And oh man, it's pretty damn easy now







.


```
java -jar framework_helper.jar [path to public xml file] [COLOR="Magenta"][# of battery images][/COLOR][COLOR="green"][# of charging images][/COLOR] [COLOR="DarkOrchid"][optional file to pull custom entries from][/COLOR]
```
Let me explain some of these real quick
[# of battery images] - usually you guys are going to have this at 100, it's the TOTAL number of images for percentage (some may want to have it at 20, but i left it flexible)

[# of charging images] - however many you want, 20 for 5% increments, or maybe just 100. note: it starts at 0, so if you want 100 charging images, the last one should be named 99. please ask if you need clarification on this.

[optional file to pull custom strings from] - if you are someone like Whitehawkx and does mods constantly, this may be of use, besides the battery images, it can add more resource IDs for whatever you might want.

To use it, please place the entries in a separate file in the format "type name"

Say I have a file called custom.txt, in the file are the following:



> drawable hawk_reboot
> drawable hawk_recovery
> drawable hawk_download
> id testid1
> id testid2


It should support ALL of the different types for public xml and assign them a proper id so you don't have to.

Supported types: "attr", "id", "style", "string", "dimen", "color", "array", "drawable", "layout", "anim", "xml", "raw", "bool", "integer", "plurals"

Then here are my inputs:

```
java -jar framework_helper.jar public.xml 100 20 custom.txt
```
The following is _ADDED _to your existing public.xml with PROPER resource Ids and in theproper location (the program does extensive checking to make sure no ids are duplicated







)


```
<public type="drawable" name="hawk_reboot" id="0x01080404" /><br />
	<public type="drawable" name="hawk_recovery" id="0x01080405" /><br />
	<public type="drawable" name="hawk_download" id="0x01080406" /><br />
	<public type="drawable" name="stat_sys_battery_1" id="0x01080423" /><br />
	<public type="drawable" name="stat_sys_battery_2" id="0x01080424" /><br />
	<public type="drawable" name="stat_sys_battery_3" id="0x01080425" /><br />
	<public type="drawable" name="stat_sys_battery_4" id="0x01080426" /><br />
	<public type="drawable" name="stat_sys_battery_5" id="0x01080427" /><br />
	<public type="drawable" name="stat_sys_battery_6" id="0x01080428" /><br />
	<public type="drawable" name="stat_sys_battery_7" id="0x01080429" /><br />
	<public type="drawable" name="stat_sys_battery_8" id="0x0108042a" /><br />
	<public type="drawable" name="stat_sys_battery_9" id="0x0108042b" /><br />
	<public type="drawable" name="stat_sys_battery_11" id="0x0108042c" /><br />
	<public type="drawable" name="stat_sys_battery_12" id="0x0108042d" /><br />
	<public type="drawable" name="stat_sys_battery_13" id="0x0108042e" /><br />
	<public type="drawable" name="stat_sys_battery_14" id="0x0108042f" /><br />
	<public type="drawable" name="stat_sys_battery_15" id="0x01080430" /><br />
	<public type="drawable" name="stat_sys_battery_16" id="0x01080431" /><br />
	<public type="drawable" name="stat_sys_battery_17" id="0x01080432" /><br />
	<public type="drawable" name="stat_sys_battery_18" id="0x01080433" /><br />
	<public type="drawable" name="stat_sys_battery_19" id="0x01080434" /><br />
	<public type="drawable" name="stat_sys_battery_21" id="0x01080435" /><br />
	<public type="drawable" name="stat_sys_battery_22" id="0x01080436" /><br />
	<public type="drawable" name="stat_sys_battery_23" id="0x01080437" /><br />
	<public type="drawable" name="stat_sys_battery_24" id="0x01080438" /><br />
	<public type="drawable" name="stat_sys_battery_25" id="0x01080439" /><br />
	<public type="drawable" name="stat_sys_battery_26" id="0x0108043a" /><br />
	<public type="drawable" name="stat_sys_battery_27" id="0x0108043b" /><br />
	<public type="drawable" name="stat_sys_battery_28" id="0x0108043c" /><br />
	<public type="drawable" name="stat_sys_battery_29" id="0x0108043d" /><br />
	<public type="drawable" name="stat_sys_battery_30" id="0x0108043e" /><br />
	<public type="drawable" name="stat_sys_battery_31" id="0x0108043f" /><br />
	<public type="drawable" name="stat_sys_battery_32" id="0x01080440" /><br />
	<public type="drawable" name="stat_sys_battery_33" id="0x01080441" /><br />
	<public type="drawable" name="stat_sys_battery_34" id="0x01080442" /><br />
	<public type="drawable" name="stat_sys_battery_35" id="0x01080443" /><br />
	<public type="drawable" name="stat_sys_battery_36" id="0x01080444" /><br />
	<public type="drawable" name="stat_sys_battery_37" id="0x01080445" /><br />
	<public type="drawable" name="stat_sys_battery_38" id="0x01080446" /><br />
	<public type="drawable" name="stat_sys_battery_39" id="0x01080447" /><br />
	<public type="drawable" name="stat_sys_battery_41" id="0x01080448" /><br />
	<public type="drawable" name="stat_sys_battery_42" id="0x01080449" /><br />
	<public type="drawable" name="stat_sys_battery_43" id="0x0108044a" /><br />
	<public type="drawable" name="stat_sys_battery_44" id="0x0108044b" /><br />
	<public type="drawable" name="stat_sys_battery_45" id="0x0108044c" /><br />
	<public type="drawable" name="stat_sys_battery_46" id="0x0108044d" /><br />
	<public type="drawable" name="stat_sys_battery_47" id="0x0108044e" /><br />
	<public type="drawable" name="stat_sys_battery_48" id="0x0108044f" /><br />
	<public type="drawable" name="stat_sys_battery_49" id="0x01080450" /><br />
	<public type="drawable" name="stat_sys_battery_50" id="0x01080451" /><br />
	<public type="drawable" name="stat_sys_battery_51" id="0x01080452" /><br />
	<public type="drawable" name="stat_sys_battery_52" id="0x01080453" /><br />
	<public type="drawable" name="stat_sys_battery_53" id="0x01080454" /><br />
	<public type="drawable" name="stat_sys_battery_54" id="0x01080455" /><br />
	<public type="drawable" name="stat_sys_battery_55" id="0x01080456" /><br />
	<public type="drawable" name="stat_sys_battery_56" id="0x01080457" /><br />
	<public type="drawable" name="stat_sys_battery_57" id="0x01080458" /><br />
	<public type="drawable" name="stat_sys_battery_58" id="0x01080459" /><br />
	<public type="drawable" name="stat_sys_battery_59" id="0x0108045a" /><br />
	<public type="drawable" name="stat_sys_battery_61" id="0x0108045b" /><br />
	<public type="drawable" name="stat_sys_battery_62" id="0x0108045c" /><br />
	<public type="drawable" name="stat_sys_battery_63" id="0x0108045d" /><br />
	<public type="drawable" name="stat_sys_battery_64" id="0x0108045e" /><br />
	<public type="drawable" name="stat_sys_battery_65" id="0x0108045f" /><br />
	<public type="drawable" name="stat_sys_battery_66" id="0x01080460" /><br />
	<public type="drawable" name="stat_sys_battery_67" id="0x01080461" /><br />
	<public type="drawable" name="stat_sys_battery_68" id="0x01080462" /><br />
	<public type="drawable" name="stat_sys_battery_69" id="0x01080463" /><br />
	<public type="drawable" name="stat_sys_battery_70" id="0x01080464" /><br />
	<public type="drawable" name="stat_sys_battery_71" id="0x01080465" /><br />
	<public type="drawable" name="stat_sys_battery_72" id="0x01080466" /><br />
	<public type="drawable" name="stat_sys_battery_73" id="0x01080467" /><br />
	<public type="drawable" name="stat_sys_battery_74" id="0x01080468" /><br />
	<public type="drawable" name="stat_sys_battery_75" id="0x01080469" /><br />
	<public type="drawable" name="stat_sys_battery_76" id="0x0108046a" /><br />
	<public type="drawable" name="stat_sys_battery_77" id="0x0108046b" /><br />
	<public type="drawable" name="stat_sys_battery_78" id="0x0108046c" /><br />
	<public type="drawable" name="stat_sys_battery_79" id="0x0108046d" /><br />
	<public type="drawable" name="stat_sys_battery_81" id="0x0108046e" /><br />
	<public type="drawable" name="stat_sys_battery_82" id="0x0108046f" /><br />
	<public type="drawable" name="stat_sys_battery_83" id="0x01080470" /><br />
	<public type="drawable" name="stat_sys_battery_84" id="0x01080471" /><br />
	<public type="drawable" name="stat_sys_battery_85" id="0x01080472" /><br />
	<public type="drawable" name="stat_sys_battery_86" id="0x01080473" /><br />
	<public type="drawable" name="stat_sys_battery_87" id="0x01080474" /><br />
	<public type="drawable" name="stat_sys_battery_88" id="0x01080475" /><br />
	<public type="drawable" name="stat_sys_battery_89" id="0x01080476" /><br />
	<public type="drawable" name="stat_sys_battery_90" id="0x01080477" /><br />
	<public type="drawable" name="stat_sys_battery_91" id="0x01080478" /><br />
	<public type="drawable" name="stat_sys_battery_92" id="0x01080479" /><br />
	<public type="drawable" name="stat_sys_battery_93" id="0x0108047a" /><br />
	<public type="drawable" name="stat_sys_battery_94" id="0x0108047b" /><br />
	<public type="drawable" name="stat_sys_battery_95" id="0x0108047c" /><br />
	<public type="drawable" name="stat_sys_battery_96" id="0x0108047d" /><br />
	<public type="drawable" name="stat_sys_battery_97" id="0x0108047e" /><br />
	<public type="drawable" name="stat_sys_battery_98" id="0x0108047f" /><br />
	<public type="drawable" name="stat_sys_battery_99" id="0x01080480" /><br />
	<public type="drawable" name="stat_sys_battery_charge_anim6" id="0x01080481" /><br />
	<public type="drawable" name="stat_sys_battery_charge_anim7" id="0x01080482" /><br />
	<public type="drawable" name="stat_sys_battery_charge_anim8" id="0x01080483" /><br />
	<public type="drawable" name="stat_sys_battery_charge_anim9" id="0x01080484" /><br />
	<public type="drawable" name="stat_sys_battery_charge_anim10" id="0x01080485" /><br />
	<public type="drawable" name="stat_sys_battery_charge_anim11" id="0x01080486" /><br />
	<public type="drawable" name="stat_sys_battery_charge_anim12" id="0x01080487" /><br />
	<public type="drawable" name="stat_sys_battery_charge_anim13" id="0x01080488" /><br />
	<public type="drawable" name="stat_sys_battery_charge_anim14" id="0x01080489" /><br />
	<public type="drawable" name="stat_sys_battery_charge_anim15" id="0x0108048a" /><br />
	<public type="drawable" name="stat_sys_battery_charge_anim16" id="0x0108048b" /><br />
	<public type="drawable" name="stat_sys_battery_charge_anim17" id="0x0108048c" /><br />
	<public type="drawable" name="stat_sys_battery_charge_anim18" id="0x0108048d" /><br />
	<public type="drawable" name="stat_sys_battery_charge_anim19" id="0x0108048e" />
```
I can also do 

```
java -jar framework_helper.jar public.xml 100 20
```
And it will just add the battery mod.

*Notes*
-If you try and add something that already exists, the program will skip it properly. for instance stat_sys_battery_20 40 60 80 will not get added because it already exists in the public xml.

I'm sure that was confusing as hell, please read over and let me know if you have any questions. Hope this saves someone time


----------



## Dewguzzler (Jun 6, 2011)

where is the framework_helper.jar? i looked on ur github but dont see the actual .jar file

nvm realized why there no 60 or 80 etc


----------



## roman (Jun 11, 2011)

Dewguzzler said:


> where is the framework_helper.jar? i looked on ur github but dont see the actual .jar file
> 
> nvm realized why there no 60 or 80 etc


Hey, sorry about that. I'll get the jars posted up on my github & here.


----------



## Dewguzzler (Jun 6, 2011)

roman said:


> Hey, sorry about that. I'll get the jars posted up on my github & here.


no problem i wasnt quite sure, i was going to try and do that for the dx, but didnt see the framework_helper.jar so i used the ones in ur example and tried to recompile and public.xml spit out all kinds of resource id errors lol


----------



## roman (Jun 11, 2011)

Dewguzzler said:


> no problem i wasnt quite sure, i was going to try and do that for the dx, but didnt see the framework_helper.jar so i used the ones in ur example and tried to recompile and public.xml spit out all kinds of resource id errors lol


Yep, it's unique to every build







.

Uploaded to OP


----------



## Dewguzzler (Jun 6, 2011)

roman said:


> Yep, it's unique to every build
> 
> 
> 
> ...


ok so just do the java commands and use the name of the jar? and do i need to create a custom.txt or just 100 20 for the battery?

edit: i got it to do it lets see it compile now lol

update. i tried to compile and it gives me all these errors about public xml about being "error: Public symbol drawable/stat_sys_battery_charge_anim6 declared here is not defined.
/home/jesse/android-sdk-linux_x86/tools/apkmanager/other/../out/res/values/public.xml:3499: error: Public symbol drawable/stat_sys_battery_charge_anim7 declared here is not defined."


----------



## roman (Jun 11, 2011)

Dewguzzler said:


> ok so just do the java commands and use the name of the jar? and do i need to create a custom.txt or just 100 20 for the battery?
> 
> edit: i got it to do it lets see it compile now lol
> 
> ...


what are they called in your XML file? and have you put in extra images? it just maps out the public xml IDs, you must make the other changes in the framework yourself


----------



## Dewguzzler (Jun 6, 2011)

roman said:


> what are they called in your XML file? and have you put in extra images? it just maps out the public xml IDs, you must make the other changes in the framework yourself


i put the images in drawable-hdpi, do i have to take tho ids and add them somewhere?


----------



## roman (Jun 11, 2011)

Dewguzzler said:


> i put the images in drawable-hdpi, do i have to take tho ids and add them somewhere?


make a new text file, like I did and call it "custom.txt" for instance

in it put this:



> drawable nameofimageyouadded
> drawable anothernameofimageyouadded
> drawable thirdname


that way when you run the jar it will add those ids automatically


----------



## Dewguzzler (Jun 6, 2011)

ok gotcha lemme get this going now, nice helper btw!

k did the custom.txt and finally got the helper to work (i forgot to put the public.xml in the command lol) made the new public xml just fine. it might be a problem with my apkmanager or something idk but it still gave me the same errors as before


----------



## Dewguzzler (Jun 6, 2011)

roman said:


> make a new text file, like I did and call it "custom.txt" for instance
> 
> in it put this:
> 
> that way when you run the jar it will add those ids automatically


i mean since its giving me errors "not defined" and the other thing do i need to put those somewhere else too?


----------



## raidzero (Jun 10, 2011)

So this can add resources of any type to an APK? If so, that is SWEET!


----------



## roman (Jun 11, 2011)

Well... you need to decompile it to get to the public.xml first, but in theory, yes it should


----------



## jmz (Oct 16, 2011)

So I'm trying to use this. I put in "Public_XML_Helper.jar public.xml custom.txt" No error message, no feedback, and no change. I have java in path I don't think that is the issue. Text file is below. Thanks



> drawable cdma_sys_4signal_5
> drawable cdma_sys_4signal_6


----------



## roman (Jun 11, 2011)

Might have to put ./custom.txt? I'll try it again when I have time


----------



## travp624 (Jun 12, 2011)

I have to ask this sorry roman. But this is for ppl decompiling and recompiling apk's correct. And this is for adding id's to public.xml of any apk. correct?

Reason I ask this is if you add to an apk after decompiled and need the public.xml to update delete the public.xml. During the recompile a completely brand new public.xml is created. At least thats how apktool used to work.


----------

