loganchien / smali

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

UNEXPECTED TOP-LEVEL EXCEPTION #208

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What seems to be the problem?
Not compiling framework.jar and some others files

What is the exact smali/baksmali command that you ran?
smali -a 18 -o android.dex out

What version of smali/baksmali are you using? What rom are you working
from?
smali.jar v2.0.3 ROM: MIUI or Sense 6

Additional information:
[Wed Apr 23 22:21:54 EEST 2014] UNEXPECTED TOP-LEVEL EXCEPTION:
[Wed Apr 23 22:21:54 EEST 2014] org.jf.util.ExceptionWithContext: Unsigned 
short value out of range: 67054
[Wed Apr 23 22:21:54 EEST 2014]     at 
org.jf.dexlib2.writer.DexDataWriter.writeUshort(DexDataWriter.java:116)
[Wed Apr 23 22:21:54 EEST 2014]     at 
org.jf.dexlib2.writer.InstructionWriter.write(InstructionWriter.java:312)
[Wed Apr 23 22:21:55 EEST 2014]     at 
org.jf.dexlib2.writer.DexWriter.writeCodeItem(DexWriter.java:980)
[Wed Apr 23 22:21:55 EEST 2014]     at 
org.jf.dexlib2.writer.DexWriter.writeDebugAndCodeItems(DexWriter.java:759)
[Wed Apr 23 22:21:55 EEST 2014]     at 
org.jf.dexlib2.writer.DexWriter.writeTo(DexWriter.java:214)
[Wed Apr 23 22:21:55 EEST 2014]     at 
org.jf.dexlib2.writer.DexWriter.writeTo(DexWriter.java:192)
[Wed Apr 23 22:21:55 EEST 2014]     at org.jf.smali.main.main(main.java:229)

Original issue reported on code.google.com by kirill.d...@gmail.com on 24 Apr 2014 at 1:25

GoogleCodeExporter commented 9 years ago
It looks like the dex file has too many methods. I'm assuming the smali files 
are generated while deodexing the framework, and are otherwise unmodified. Is 
that the case?

Assuming so, then this is likely due to the fact that while deodexing, it can 
resolve an odexed method using any of several different equivalent overrides of 
the method. 

e.g. it could use either Lcom/blah/Class;->toString()Ljava/lang/String; or 
Ljava/lang/Object;->toString()Ljava/lang/String; to refer to the toString 
method on the com.blah.Class class.

And in some cases, this might inflate the method count slightly, if it uses a 
different override than was present in the original dex file. And if the 
original dex file was close to the limit, this might be enough to push it over 
the limit.

Unfortunately, there's no easy way to fix this in smali/baksmali. I think your 
best bet would be to move some of the classes to something like the 
framework2.jar, to reduce the method count.

Original comment by jesusfreke@jesusfreke.com on 24 Apr 2014 at 6:54