xychix / smali

Automatically exported from code.google.com/p/smali
0 stars 0 forks source link

services.jar's classes.dex becomes corrupted on recompile #48

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What seems to be the problem?
I can't properly recompile classes.dex after just decompiling it - file size 
differs, and hex editor shows corruption.

What is the exact smali/baksmali command that you ran?
Do decompile: java -jar baksmali.jar -o out/ classes.dex
To recompile: java -Xmx512 -jar smali.jar  out/ -o new-classes.dex

I have also tried without the Xmx512 option.

What version of smali/baksmali are you using? What rom are you working
from?
I'm using the latest version (1.2.5), and working on services.jar from 
SonyEricsson's X10 Android 2.1 stock rom (global generic).

What is the airspeed velocity of an unladen swallow?

Please provide any additional information below: error messages, symptoms,
etc.
It seems I am loosing 8 bytes in the recompiled version, and as I mentioned 
everything seems to be corrupted when viewing through HexCompare.

Original issue reported on code.google.com by dsv.ru...@gmail.com on 13 Nov 2010 at 8:12

Attachments:

GoogleCodeExporter commented 9 years ago
I disassembled and then reassembled the file you provided, and the resulting 
file looks ok to me. It is 8 bytes smaller, as you mentioned, but this doesn't 
mean that it is corrupted. The order of various items in the dex file can 
differ, and due to the way offsets are stored, smaller offsets take less space 
- hence the size difference.

Regarding the so called "corruption" you see when looking at a byte-level 
comparison of the two files - the dex format uses byte offsets for many things, 
so a single item that is ordered differently can actually cause many byte-level 
differences, due to the byte offsets being different.

In short, as far as I can tell, everything is working as expected and I don't 
see any problems. Have you actually tried pushing the re-assembled dex file to 
the phone to see if it works?

Original comment by JesusFr...@gmail.com on 13 Nov 2010 at 8:21

GoogleCodeExporter commented 9 years ago

Original comment by JesusFr...@gmail.com on 13 Nov 2010 at 11:19