I have an android project with robolectric tests, a total of about 2084 test units right now. But I ran into problems adding more tests due to 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
with strack trace, I get the following
* 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) ...
In my `gradle.properties in the root directory and my modules directory, I tried to put the following and nothing worked. I still have a memory problem.
org.gradle.jvmargs=-Xmx1024m -XX:MaxPermSize=512m -Xms512m
I tried the options from Android Studio Gradle Problem: OutOfMemoryError: PermGen space is still out of luck. I also watched sonarRunner java.lang.OutOfMemoryError: PermGen space .
Hope to help you with this. Thanks
source share