美文网首页
OutOfMemoryError while compiling

OutOfMemoryError while compiling

作者: Ggx的代码之旅 | 来源:发表于2016-06-03 18:43 被阅读84次

Have you ever got a OutOfMemoryError while compiling an Android project, just like this?

Unknown source file : Uncaught translation error: java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: Java heap space
Unknown source file : 1 error; aborting

:app:dexDebug FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:dexDebug'.
> com.android.ide.common.process.ProcessException: 
> org.gradle.process.internal.ExecException: 
> Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1```

The quick solution is: add javaMaxHeapSize to dexOptions in your build.gradle, adjusting the value on your needs.

android {
...

dexOptions {
    javaMaxHeapSize "4g"
}

...

}```

相关文章

网友评论

      本文标题:OutOfMemoryError while compiling

      本文链接:https://www.haomeiwen.com/subject/xfhldttx.html