gpt4 book ai didi

Android Espresso - java.lang.OutOfMemoryError : GC overhead limit exceeded

转载 作者:太空狗 更新时间:2023-10-29 16:18:59 27 4
gpt4 key购买 nike

当我在我的项目中包含 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,编译永远不会超过一分钟。

最佳答案

我认为有一种单独的方法可以提高 dexing 操作的堆限制。将此添加到您的 build.gradle 文件中的 android 闭包中:

dexOptions {
incremental true
javaMaxHeapSize "4g"
}

关于Android Espresso - java.lang.OutOfMemoryError : GC overhead limit exceeded,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20340498/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com