gpt4 book ai didi

java - 获取错误 :java. lang.OutOfMemoryError:超出 GC 开销限制

转载 作者:搜寻专家 更新时间:2023-11-01 07:49:10 24 4
gpt4 key购买 nike

我收到错误:UNEXPECTED TOP-LEVEL。日志显示增加堆大小。我在应用程序中添加了 android:largeHeap = true 。然后我也收到这个错误。

list :

  <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">

日志:

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

要做什么?

最佳答案

日志说

"To do this set org.gradle.jvmargs=-Xmx2048M in the project gradle.properties."

因此,打开你的 gradle.properties 文件并添加行“org.gradle.jvmargs=-Xmx2048M”

关于java - 获取错误 :java. lang.OutOfMemoryError:超出 GC 开销限制,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37879121/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com