[英]Getting Error:java.lang.OutOfMemoryError: GC overhead limit exceeded
I am getting Error:UNEXPECTED TOP-LEVEL. 我收到错误消息:未达到预期的最高水平。 The log shows to increase the heap size.
日志显示增加堆大小。 I have added android:largeHeap = true in an application.
我在应用程序中添加了android:largeHeap = true。 Then also I am getting this error.
然后我也收到此错误。
Manifest: 表现:
<application
android:allowBackup="true"
android:name="android.support.multidex.MultiDexApplication"
android:icon="@drawable/icon1"
android:label="@string/app_name"
android:largeHeap="true"
android:supportsRtl="true"
android:theme="@style/AppTheme">
Log: 日志:
To run dex in process, the Gradle daemon needs a larger heap.
It currently has approximately 910 MB.
For faster builds, increase the maximum heap size for the Gradle daemon to more than 2048 MB.
To do this set org.gradle.jvmargs=-Xmx2048M in the project gradle.properties.
For more information see https://docs.gradle.org/current/userguide/build_environment.html
Error:UNEXPECTED TOP-LEVEL ERROR:
Error:java.lang.OutOfMemoryError: GC overhead limit exceeded
Error: at java.util.Arrays.copyOf(Arrays.java:3236)
Error: at java.io.ByteArrayOutputStream.toByteArray(ByteArrayOutputStream.java:191)
Error: at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:279)
Error: at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
Error: at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
Error: at com.android.dx.command.dexer.Main.processOne(Main.java:672)
Error: at com.android.dx.command.dexer.Main.processAllFiles(Main.java:569)
Error: at com.android.dx.command.dexer.Main.runMultiDex(Main.java:366)
Error: at com.android.dx.command.dexer.Main.run(Main.java:275)
Error: at com.android.dx.command.dexer.Main.main(Main.java:245)
Error: at com.android.dx.command.Main.main(Main.java:106)
:app:transformClassesWithDexForDebug FAILED
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_51\bin\java.exe'' finished with non-zero exit value 3
Information:BUILD FAILED
Information:Total time: 7 mins 31.106 secs
Information:14 errors
Information:0 warnings
Information:See complete output in console
What to do? 该怎么办?
In your build.gradle
Try to add this : 在您的
build.gradle
尝试添加以下内容:
dexOptions {
incremental true
javaMaxHeapSize "4g"
}
incremental true
is using to speed up your builds. incremental true
用于加快构建速度。 javaMaxHeapSize "4g"
to specify the heap size for the dex process. javaMaxHeapSize "4g"
指定dex进程的堆大小。 The log says 日志说
"To do this set org.gradle.jvmargs=-Xmx2048M in the project gradle.properties."
“为此,请在项目gradle.properties中设置org.gradle.jvmargs = -Xmx2048M。”
So open your gradle.properties file and add the line "org.gradle.jvmargs=-Xmx2048M" 因此,打开您的gradle.properties文件并添加“ org.gradle.jvmargs = -Xmx2048M”行
Your log: 您的日志:
To do this set org.gradle.jvmargs=-Xmx2048M in the project gradle.properties
为此,请在项目gradle.properties中设置org.gradle.jvmargs = -Xmx2048M
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.