kapt An exception occurred: java.lang.OutOfMemoryError: GC overhead limit exceeded
kapt An exception occurred: java.lang.OutOfMemoryError: GC overhead limit exceeded
我遇到了这个问题,在构建我的代码时出现了这个异常。我尝试在 build.gradle 和 Manifest 文件中增加堆 space,但其中 none 似乎有效。我还更改了 gradle 属性,但效果不佳。
我认为的问题是我正在使用数据绑定和空间,并且在为相同的文件生成文件时不知何故出现了这个异常。
e: [kapt] An exception occurred: java.lang.OutOfMemoryError: GC overhead limit exceeded
at com.google.googlejavaformat.Doc$State.withColumn(Doc.java:81)
at com.google.googlejavaformat.Doc$Token.computeBreaks(Doc.java:486)
at com.google.googlejavaformat.Doc$Level.computeSplit(Doc.java:330)
at com.google.googlejavaformat.Doc$Level.computeBreakAndSplit(Doc.java:320)
at com.google.googlejavaformat.Doc$Level.computeBroken(Doc.java:296)
at com.google.googlejavaformat.Doc$Level.computeBreaks(Doc.java:266)
at com.google.googlejavaformat.Doc$Level.computeSplit(Doc.java:330)
at com.google.googlejavaformat.Doc$Level.computeBreakAndSplit(Doc.java:320)
at com.google.googlejavaformat.Doc$Level.computeBroken(Doc.java:290)
at com.google.googlejavaformat.Doc$Level.computeBreaks(Doc.java:266)
at com.google.googlejavaformat.Doc$Level.computeSplit(Doc.java:330)
at com.google.googlejavaformat.Doc$Level.computeBreakAndSplit(Doc.java:320)
at com.google.googlejavaformat.Doc$Level.computeBroken(Doc.java:296)
at com.google.googlejavaformat.Doc$Level.computeBreaks(Doc.java:266)
at com.google.googlejavaformat.Doc$Level.computeSplit(Doc.java:330)
at com.google.googlejavaformat.Doc$Level.computeBreakAndSplit(Doc.java:320)
at com.google.googlejavaformat.Doc$Level.computeBroken(Doc.java:290)
at com.google.googlejavaformat.Doc$Level.computeBreaks(Doc.java:266)
at com.google.googlejavaformat.Doc$Level.computeSplit(Doc.java:330)
at com.google.googlejavaformat.Doc$Level.computeBreakAndSplit(Doc.java:320)
at com.google.googlejavaformat.Doc$Level.computeBroken(Doc.java:296)
at com.google.googlejavaformat.Doc$Level.computeBreaks(Doc.java:266)
at com.google.googlejavaformat.Doc$Level.computeSplit(Doc.java:330)
at com.google.googlejavaformat.Doc$Level.computeBreakAndSplit(Doc.java:320)
at com.google.googlejavaformat.Doc$Level.computeBroken(Doc.java:290)
at com.google.googlejavaformat.Doc$Level.computeBreaks(Doc.java:266)
at com.google.googlejavaformat.Doc$Level.computeSplit(Doc.java:330)
at com.google.googlejavaformat.Doc$Level.computeBreakAndSplit(Doc.java:320)
at com.google.googlejavaformat.Doc$Level.computeBroken(Doc.java:296)
at com.google.googlejavaformat.Doc$Level.computeBreaks(Doc.java:266)
at com.google.googlejavaformat.java.Formatter.format(Formatter.java:181)
at com.google.googlejavaformat.java.Formatter.getFormatReplacements(Formatter.java:245)
:app:kaptDebugKotlin FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:kaptDebugKotlin'.
> Compilation error. See log for more details
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or - -debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 5m 7s
以下 gradle 设置对我有用。
-Xms256m -Xmx4096m -XX:MaxPermSize=350m -XX:ReservedCodeCacheSize=225m -XX:+UseCompressedOops
这会作为 org.gradle.jvargs 参数的值进入您的 settings.gradle 文件,例如
org.gradle.jvmargs=-Xms2560m -Xmx4096m -XX:MaxPermSize=350m -XX:ReservedCodeCacheSize=225m -XX:+UseCompressedOops
放线
org.gradle.jvmargs=-Xms2560m -Xmx4096m -XX:MaxPermSize=350m -XX:ReservedCodeCacheSize=225m -XX:+UseCompressedOops
到您的gradle.properties(项目属性)
为特定作业设置堆大小的另一种方法是为每个作业使用环境变量。这可确保在不使用需要更高内存的作业时内存可用。
GRADLE_OPTS="-Dorg.gradle.jvmargs=-Xms1024M -Xmx8192M -XX:PermSize=512M -XX:MaxPermSize=2048 -XX:+CMSClassUnloadingEnabled -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8"
JAVA_OPTS="-XX:MaxPermSize=2048M"
我遇到了这个问题,在构建我的代码时出现了这个异常。我尝试在 build.gradle 和 Manifest 文件中增加堆 space,但其中 none 似乎有效。我还更改了 gradle 属性,但效果不佳。
我认为的问题是我正在使用数据绑定和空间,并且在为相同的文件生成文件时不知何故出现了这个异常。
e: [kapt] An exception occurred: java.lang.OutOfMemoryError: GC overhead limit exceeded
at com.google.googlejavaformat.Doc$State.withColumn(Doc.java:81)
at com.google.googlejavaformat.Doc$Token.computeBreaks(Doc.java:486)
at com.google.googlejavaformat.Doc$Level.computeSplit(Doc.java:330)
at com.google.googlejavaformat.Doc$Level.computeBreakAndSplit(Doc.java:320)
at com.google.googlejavaformat.Doc$Level.computeBroken(Doc.java:296)
at com.google.googlejavaformat.Doc$Level.computeBreaks(Doc.java:266)
at com.google.googlejavaformat.Doc$Level.computeSplit(Doc.java:330)
at com.google.googlejavaformat.Doc$Level.computeBreakAndSplit(Doc.java:320)
at com.google.googlejavaformat.Doc$Level.computeBroken(Doc.java:290)
at com.google.googlejavaformat.Doc$Level.computeBreaks(Doc.java:266)
at com.google.googlejavaformat.Doc$Level.computeSplit(Doc.java:330)
at com.google.googlejavaformat.Doc$Level.computeBreakAndSplit(Doc.java:320)
at com.google.googlejavaformat.Doc$Level.computeBroken(Doc.java:296)
at com.google.googlejavaformat.Doc$Level.computeBreaks(Doc.java:266)
at com.google.googlejavaformat.Doc$Level.computeSplit(Doc.java:330)
at com.google.googlejavaformat.Doc$Level.computeBreakAndSplit(Doc.java:320)
at com.google.googlejavaformat.Doc$Level.computeBroken(Doc.java:290)
at com.google.googlejavaformat.Doc$Level.computeBreaks(Doc.java:266)
at com.google.googlejavaformat.Doc$Level.computeSplit(Doc.java:330)
at com.google.googlejavaformat.Doc$Level.computeBreakAndSplit(Doc.java:320)
at com.google.googlejavaformat.Doc$Level.computeBroken(Doc.java:296)
at com.google.googlejavaformat.Doc$Level.computeBreaks(Doc.java:266)
at com.google.googlejavaformat.Doc$Level.computeSplit(Doc.java:330)
at com.google.googlejavaformat.Doc$Level.computeBreakAndSplit(Doc.java:320)
at com.google.googlejavaformat.Doc$Level.computeBroken(Doc.java:290)
at com.google.googlejavaformat.Doc$Level.computeBreaks(Doc.java:266)
at com.google.googlejavaformat.Doc$Level.computeSplit(Doc.java:330)
at com.google.googlejavaformat.Doc$Level.computeBreakAndSplit(Doc.java:320)
at com.google.googlejavaformat.Doc$Level.computeBroken(Doc.java:296)
at com.google.googlejavaformat.Doc$Level.computeBreaks(Doc.java:266)
at com.google.googlejavaformat.java.Formatter.format(Formatter.java:181)
at com.google.googlejavaformat.java.Formatter.getFormatReplacements(Formatter.java:245)
:app:kaptDebugKotlin FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:kaptDebugKotlin'.
> Compilation error. See log for more details
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or - -debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 5m 7s
以下 gradle 设置对我有用。
-Xms256m -Xmx4096m -XX:MaxPermSize=350m -XX:ReservedCodeCacheSize=225m -XX:+UseCompressedOops
这会作为 org.gradle.jvargs 参数的值进入您的 settings.gradle 文件,例如
org.gradle.jvmargs=-Xms2560m -Xmx4096m -XX:MaxPermSize=350m -XX:ReservedCodeCacheSize=225m -XX:+UseCompressedOops
放线
org.gradle.jvmargs=-Xms2560m -Xmx4096m -XX:MaxPermSize=350m -XX:ReservedCodeCacheSize=225m -XX:+UseCompressedOops
到您的gradle.properties(项目属性)
为特定作业设置堆大小的另一种方法是为每个作业使用环境变量。这可确保在不使用需要更高内存的作业时内存可用。
GRADLE_OPTS="-Dorg.gradle.jvmargs=-Xms1024M -Xmx8192M -XX:PermSize=512M -XX:MaxPermSize=2048 -XX:+CMSClassUnloadingEnabled -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8"
JAVA_OPTS="-XX:MaxPermSize=2048M"