How can i solve error: java.lang.OutOfMemoryError: GC overhead limit exceeded?
How can i solve error: java.lang.OutOfMemoryError: GC overhead limit exceeded?
我更新了我的 Android Studio 并尝试 运行 一个应用程序,但它显示这样的错误..
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: GC overhead limit exceeded
在更新 Android Studio 相同的应用程序之前 运行 很好,所以我试图解决这个问题,但我只发现了一个我已经完成的gradle 文件..
dexOptions {
incremental true
javaMaxHeapSize "4g"
}
所以现在我能做些什么来解决这个问题,请帮助我。谢谢
将此添加到您的 gradle.properties
文件中。
# The Gradle daemon aims to improve the startup and execution time of Gradle.
# When set to true the Gradle daemon is to run the build.
org.gradle.daemon=true
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx10248m -XX:MaxPermSize=256m
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
org.gradle.parallel=true
# Enables new incubating mode that makes Gradle selective when configuring projects.
# Only relevant projects are configured which results in faster builds for large multi-projects.
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:configuration_on_demand
org.gradle.configureondemand=true
在我的 build.gradle
上:
....
dexOptions
{
incremental false
javaMaxHeapSize "2048M"
preDexLibraries = false
}//end dexOptions
....
找到Here
还有我的回答
- 转到 "System Properties" -> "Advanced"
- 环境变量
- 将 _JAVA_OPTIONS 值从“-Xms1024m”修改为“-Xms2048m”
(如果不存在 _JAVA_OPTIONS 然后点击新建按钮创建它)
- 好的,保存并重启系统
我认为这对你有帮助
我更新了我的 Android Studio 并尝试 运行 一个应用程序,但它显示这样的错误..
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: GC overhead limit exceeded
在更新 Android Studio 相同的应用程序之前 运行 很好,所以我试图解决这个问题,但我只发现了一个我已经完成的gradle 文件..
dexOptions {
incremental true
javaMaxHeapSize "4g"
}
所以现在我能做些什么来解决这个问题,请帮助我。谢谢
将此添加到您的 gradle.properties
文件中。
# The Gradle daemon aims to improve the startup and execution time of Gradle.
# When set to true the Gradle daemon is to run the build.
org.gradle.daemon=true
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx10248m -XX:MaxPermSize=256m
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
org.gradle.parallel=true
# Enables new incubating mode that makes Gradle selective when configuring projects.
# Only relevant projects are configured which results in faster builds for large multi-projects.
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:configuration_on_demand
org.gradle.configureondemand=true
在我的 build.gradle
上:
....
dexOptions
{
incremental false
javaMaxHeapSize "2048M"
preDexLibraries = false
}//end dexOptions
....
找到Here
还有我的回答
- 转到 "System Properties" -> "Advanced"
- 环境变量
- 将 _JAVA_OPTIONS 值从“-Xms1024m”修改为“-Xms2048m”
(如果不存在 _JAVA_OPTIONS 然后点击新建按钮创建它) - 好的,保存并重启系统
我认为这对你有帮助