小编RaI*_*qer的帖子

osx maven运行测试异常:从线程"main"中的UncaughtExceptionHandler抛出java.lang.OutOfMemoryError

我一直在尝试在mac上运行一个在linux下工作的maven项目.当mvn clean install 它调用 它运行一部分测试,然后我收到以下错误:

线程"main"中的异常异常:从线程"main"中的UncaughtExceptionHandler抛出java.lang.OutOfMemoryError

我已经看到许多关于Perm gen error的问题已经通过添加MAVEN_OPTS到环境变量来修复.现在我的系统上有以下环境变量:

MAVEN_OPTS =" - Xmx4096m -XX:MaxPermSize = 4096m"

通话时mvn help:system我可以看到配置中显示的这些选项.

该项目使用Robolectric进行测试,并且(在大多数情况下但并非总是如此)在抛出异常之前打印以下行:

[DEBUG]***********************GC'ed SdkEnvironment重复使用!

[ERROR]无法在org.robolectric.bytecode.AsmInstrumentingClassLoader@300abe53中加载org.robolectric.internal.ParallelUniverse

在活动监视器中,我可以看到一个java进程在我开始测试时生效.在抛出异常之前,它的内存使用量达到1.4~1.5GB.

我还应该做些什么才能让它发挥作用.谢谢你的帮助!

将内存选项添加到确定的fire插件后编辑:

           <plugin>
               <groupId>org.apache.maven.plugins</groupId>
               <artifactId>maven-surefire-plugin</artifactId>
               <version>2.16</version>
               <configuration>
                   <argLine>-Xmx2048m -XX:MaxPermSize=2048m</argLine>
               </configuration>
           </plugin>
Run Code Online (Sandbox Code Playgroud)

并且运行mvn clean install -e -X我得到了以下堆栈跟踪:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.17:test (default-test) on project android: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.17:test failed: There was an error in the forked process
[ERROR] java.lang.OutOfMemoryError: PermGen space
[ERROR] at java.lang.ClassLoader.defineClass1(Native Method) …
Run Code Online (Sandbox Code Playgroud)

java macos android maven robolectric

11
推荐指数
1
解决办法
2万
查看次数

Kotlin 崩溃无法将提供的符号转换为依赖项类型的对象:org.jetbrains.kotlin.gradle.dsl.KotlinProjectExtension_Decolated

将 kotlin 版本从 1.0.5-2 升级到 1.1.0 后出现崩溃:

Error:(114, 0) Cannot convert the provided notation to an object of type Dependency: org.jetbrains.kotlin.gradle.dsl.KotlinProjectExtension_Decorated@5a39a165.
The following types/formats are supported:
  - Instances of Dependency.
  - String or CharSequence values, for example 'org.gradle:gradle-core:1.0'.
  - Maps, for example [group: 'org.gradle', name: 'gradle-core', version: '1.0'].
  - FileCollections, for example files('some.jar', 'someOther.jar').
  - Projects, for example project(':some:project:path').
  - ClassPathNotation, for example gradleApi().

Comprehensive documentation on dependency notations is available in DSL reference for DependencyHandler type.
Run Code Online (Sandbox Code Playgroud)

该项目未同步,因此我无法调用 gradle 依赖项或其他任何内容。 …

android gradle kotlin

4
推荐指数
1
解决办法
4683
查看次数

标签 统计

android ×2

gradle ×1

java ×1

kotlin ×1

macos ×1

maven ×1

robolectric ×1