SK-Yang / android-apktool

Automatically exported from code.google.com/p/android-apktool
0 stars 0 forks source link

Enhancement: Rebuild resources from scratch #754

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
while modding apps, many a times resources are removed or changed. These cause 
resource errors while rebuilding. I suggest resources be mapped to R.XX.XXXX 
mode while decoding to smali and then code back to 0x7f0X00XX mode.

I have written a test program that helps do this.

> smali_resources_rebuild (decode|encode|check) dir/

Decode : Converts 0x7f0X0XXX ~~~> R.XX.XXX
Encode : Converts R.XX.XXX ~~~> 0x7f0X0XXX
Check  : Returns any left back R.XX.XXX syntax. Use this to remove the code 
that is unnecessary. 

Deleting Resources from R$XX.smali files after decode to not include it while 
check and rebuild.

What do you guys think? 
Do let me know

Original issue reported on code.google.com by newton3...@gmail.com on 1 Feb 2015 at 9:48

Attachments:

GoogleCodeExporter commented 9 years ago
There was an attempt about 3 years ago to do something similar (remap resource 
ids to their literal reference). The problem is that doing this efficiently in 
java with smali code proved to be very difficult.

However, in 3 years dexlib has been rewritten to dexlib2 and this may be 
possible. I may keep this open for now or close it as duplicate for #133, but 
you may experiment with a merge request with this functionality and I will 
consider it.

Original comment by connor.tumbleson on 3 Feb 2015 at 9:51

GoogleCodeExporter commented 9 years ago
I just read the issue you referenced (#133) and i agree that using public.xml 
is a much better way than R$XXXXX.smali files. As far as things go i am not an 
avid java programmer and will not be able to do things in java. I can, on the 
contrary, write bash code for the same and then port it to java. If that's ok 
then i will post my updated code and my java port here.

Original comment by newton3...@gmail.com on 6 Feb 2015 at 2:24