gpt4 book ai didi

Android Robolectric Gradle - java.lang.OutOfMemoryError : PermGen space

转载 作者:塔克拉玛干 更新时间:2023-11-02 22:14:20 26 4
gpt4 key购买 nike

我有一个带有 robolectric 测试的 android 项目设置,目前总共有大约 2084 个单元测试。但是由于 java.lang.OutOfMemoryError: PermGen space,我在添加更多测试时遇到了问题。

objc[11380]: Class JavaLaunchHelper is implemented in both /Library/Java/JavaVirtualMachines/jdk1.7.0_71.jdk/Contents/Home/bin/java and /Library/Java/JavaVirtualMachines/jdk1.7.0_71.jdk/Contents/Home/jre/lib/libinstrument.dylib. One of the two will be used. Which one is undefined.
java.lang.OutOfMemoryError: PermGen space
Exception in thread "Test worker" java.lang.OutOfMemoryError: PermGen space
Exception in thread "Thread-0" java.lang.OutOfMemoryError: PermGen space
:app:testDebug FAILED

通过 strack 跟踪,我得到以下内容

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:testDebug'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)
at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:64)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java
...
Caused by: org.gradle.process.internal.ExecException: Process 'Gradle Test Executor 1' finished with non-zero exit value 1
at org.gradle.process.internal.DefaultExecHandle$ExecResultImpl.assertNormalExitValue(DefaultExecHandle.java:365)
at org.gradle.process.internal.DefaultWorkerProcess.waitForStop(DefaultWorkerProcess.java:161)
at org.gradle.api.internal.tasks.testing.worker.ForkingTestClassProcessor.stop(ForkingTestClassProcessor.java:86)
at org.gradle.api.internal.tasks.testing.processors.RestartEveryNTestClassProcessor.endBatch(RestartEveryNTestClassProcessor.java:60)
at org.gradle.api.internal.tasks.testing.processors.RestartEveryNTestClassProcessor.stop(RestartEveryNTestClassProcessor.java:54)
at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
...

在根目录和模块目录中的`gradle.properties 中,我尝试放置以下内容但没有任何效果。我仍然遇到内存不足的问题。

org.gradle.jvmargs=-Xmx1024m -XX:MaxPermSize=512m -Xms512m

我已经尝试了 Android Studio Gradle Issue: OutOfMemoryError: PermGen space 中的选项仍然没有运气。我也一直在看 sonarRunner java.lang.OutOfMemoryError: PermGen space .

希望在这方面得到一些帮助。谢谢

最佳答案

尝试大于 512m 的数字:org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=1024m -Xms512m

编辑

正如@Eugen Martynov 提到的,如果您使用robolectric gradle 插件,您可以将它们指定为DSL configuration

关于Android Robolectric Gradle - java.lang.OutOfMemoryError : PermGen space,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27727670/

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