本帖最后由 wxw1145897898 于 2018-7-10 09:15 编辑
今天遇到一款APP,是乐固的壳,脱下壳生成,了几个dex文件,分辨后,最终剩下了两个dex文件,将其中一个文件修复改名字改xml文件操作后,本以为修复成功,没想到程序打开闪退,故查看报错日志,发现缺少了一个类,这个类在第二个dex中找到,所以猜测这两个dex可能是一个文件,于是,用dex2jar工具http://code.google.com/p/dex2jar/downloads/list 将dex拖进去,转成了jar文件,然后用文件对比工具将两个jar包合并,并采用dx.bat想将文件重新转会dex文件时却出现了问题[C] 纯文本查看 复制代码 F:\adt-bundle-windows-x86-20130917\sdk\build-tools\25.0.2>F:\adt-bundle-windows-x86-20130917\sdk\build-tools\25.0.2\dx.bat --dex --output=class.dex C:\Users\Administrator\Desktop\classes-dex2jar.jar
UNEXPECTED TOP-LEVEL ERROR:
java.lang.OutOfMemoryError: GC overhead limit exceeded
at com.android.dx.ssa.ConstCollector.getConstsSortedByCountUse(ConstCollector.java:160)
at com.android.dx.ssa.ConstCollector.run(ConstCollector.java:93)
at com.android.dx.ssa.ConstCollector.process(ConstCollector.java:75)
at com.android.dx.ssa.Optimizer.runSsaFormSteps(Optimizer.java:181)
at com.android.dx.ssa.Optimizer.optimize(Optimizer.java:99)
at com.android.dx.ssa.Optimizer.optimize(Optimizer.java:72)
at com.android.dx.dex.cf.CfTranslator.processMethods(CfTranslator.java:299)
at com.android.dx.dex.cf.CfTranslator.translate0(CfTranslator.java:139)
at com.android.dx.dex.cf.CfTranslator.translate(CfTranslator.java:94)
at com.android.dx.command.dexer.Main.processClass(Main.java:682)
at com.android.dx.command.dexer.Main.processFileBytes(Main.java:634)
at com.android.dx.command.dexer.Main.access$600(Main.java:78)
at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:572)
at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
at com.android.dx.command.dexer.Main.processOne(Main.java:596)
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:498)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:264)
at com.android.dx.command.dexer.Main.run(Main.java:230)
at com.android.dx.command.dexer.Main.main(Main.java:199)
at com.android.dx.command.Main.main(Main.java:103)
百度之后找到解决方案 我在后面添加两个参数
[C] 纯文本查看 复制代码 F:\adt-bundle-windows-x86-20130917\sdk\build-tools\25.0.2>F:\adt-bundle-windows-x86-20130917\sdk\build-tools\25.0.2\dx.bat --dex --output=class.dex C:\Users\Administrator\Desktop\classes-dex2jar.jar -JXms1024M -JXmx2048M
结果他又报新错误
[C] 纯文本查看 复制代码 trouble writing output: Too many method references: 81076; max is 65536.
You may try using --multi-dex option.
References by package:
30 a.a.a
15 a.a.b
11 android.accessibilityservice
104 android.animation
370 android.app
9 android.app.job
3 android.appwidget
2 android.arch.a
22 android.arch.a.a
53 android.arch.a.b
1 android.arch.a.c
于是我有添加参数如图
[C] 纯文本查看 复制代码 F:\adt-bundle-windows-x86-20130917\sdk\build-tools\25.0.2>F:\adt-bundle-windows-x86-20130917\sdk\build-tools\25.0.2\dx.bat --multi-dex --dex --output=C:\Users\Administrator\Desktop\ C:\Users\Administrator\Desktop\classes-dex2jar.jar -JXms1024M -JXmx2048M
转换完成,完成了以上步骤我相当我做了一份无用功,合并到一起又拆开了。
即当编译引用的jar太多的时候,就会出现:trouble writing output: Too many method references: 90356; max is 65536.
You may try using --multi-dex option.
这时候就需要拆成两个dex文件。
最终程序完美脱壳运行
详细的修复过程参考我的帖子:https://www.52pojie.cn/forum.php ... ;page=1#pid18740799
---end--- |