在Android 5.0以上,使用 apktool 2.0, 对framework.jar包重编译时,可能会出现如下错误:
-
I: Using Apktool 2.0.0-RC4
-
I: Checking whether sources has changed...
-
I: Smaling smali folder into classes.dex...
-
Exception in thread "main" org.jf.util.ExceptionWithContext: Unsigned short value out of range: 71412
-
at org.jf.dexlib2.writer.DexDataWriter.writeUshort(DexDataWriter.java:116)
-
at org.jf.dexlib2.writer.InstructionWriter.write(InstructionWriter.java:312)
-
at org.jf.dexlib2.writer.DexWriter.writeCodeItem(DexWriter.java:990)
-
at org.jf.dexlib2.writer.DexWriter.writeDebugAndCodeItems(DexWriter.java:769)
-
at org.jf.dexlib2.writer.DexWriter.writeTo(DexWriter.java:222)
-
at org.jf.dexlib2.writer.DexWriter.writeTo(DexWriter.java:200)
-
at brut.androlib.src.SmaliBuilder.build(SmaliBuilder.java:57)
-
at brut.androlib.src.SmaliBuilder.build(SmaliBuilder.java:41)
-
at brut.androlib.Androlib.buildSourcesSmali(Androlib.java:354)
-
at brut.androlib.Androlib.buildSources(Androlib.java:294)
-
at brut.androlib.Androlib.build(Androlib.java:280)
-
at brut.androlib.Androlib.build(Androlib.java:255)
-
at brut.apktool.Main.cmdBuild(Main.java:225)
-
at brut.apktool.Main.main(Main.java:84)
很多开发者之前遇到过framework.jar的函数超过限制,需要拆分,所以在Android 5.0以下的版本,会有诸如framework2.jar, framework-ext.jar, secondary-framework.jar这样的framework拆分包。但Android 5.0不再拆分jar包,而是直接拆分dex包,所以在framework.jar包中,会包含 classes.dex和classes2.dex这两个dex包,同样是为了解决函数超过限制的问题。
当其中某一个dex包的函数数量超过限制,在做apktool重编译时,就会出现如上错误。只需要将部分文件挪到另一个dex包中便可解决这个报错。
阅读(7600) | 评论(1) | 转发(0) |