当我在项目中包含 espresso 快照 jar 时,我的 gradle 编译挂起,然后退出并显示以下消息:
UNEXPECTED TOP-LEVEL ERROR:
java.lang.OutOfMemoryError: GC overhead limit exceeded
at java.util.Arrays.copyOf(Arrays.java:2219)
at java.util.ArrayList.toArray(ArrayList.java:358)
at java.util.ArrayList.<init>(ArrayList.java:164)
at com.android.dx.ssa.SsaMethod.getUseListCopy(SsaMethod.java:660)
at com.android.dx.ssa.ConstCollector.updateConstUses(ConstCollector.java:333)
at com.android.dx.ssa.ConstCollector.run(ConstCollector.java:147)
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:303)
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)
:Project:dexFlavorEnterpriseDebug FAILED
根据我的研究,这听起来像是一个依赖问题。你会建议我如何解决这个问题?
我尝试碰撞堆空间(-Xmx2048),但构建运行了很长一段时间(几分钟),而我的计算机越来越热但没有完成。如果没有这个 jar,编译永远不会超过一分钟。