Android studio Gradle无法启动守护进程



我想尝试android studio,但当我创建一个项目时,我得到这个错误:

Unable to start the daemon process.
This problem might be caused by incorrect configuration of the daemon.
For example, an unrecognized jvm option is used.
Please refer to the User Manual chapter on the daemon at https://docs.gradle.org/6.7.1/userguide/gradle_daemon.html
Process command line: C:Program FilesAndroidAndroid Studiojrebinjava.exe --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.lang.invoke=ALL-UNNAMED --add-opens java.prefs/java.util.prefs=ALL-UNNAMED -Xmx2048m -Dfile.encoding=UTF-8 -Duser.country=US -Duser.language=en -Duser.variant -cp C:Userslaszl.gradlewrapperdistsgradle-6.7.1-binbwlcbys1h7rz3272sye1xwiv6gradle-6.7.1libgradle-launcher-6.7.1.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 6.7.1
Please read the following process output to find out more:
-----------------------
OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x0000000080000000, 268435456, 0) failed; error='The paging file is too small for this operation to complete' (DOS error/errno=1455)
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (mmap) failed to map 268435456 bytes for Failed to commit area from 0x0000000080000000 to 0x0000000090000000 of length 268435456.
# An error report file with more information is saved as:
# C:Userslaszl.gradledaemon6.7.1hs_err_pid30736.log
-----------------------
Check the JVM arguments defined for the gradle process in:
- gradle.properties in project root directory

就我所见,我需要更多的内存,但我有16gb的ram和android studio已经使用12gb。

JVM使用称为heap的东西来决定在执行必要的任务时将占用多少内存。您可以把它看作是在运行时保存用户定义的数据类型的地方。它类似于RAM,但不完全是

两个解

  1. 您可以使用基于gui的方式管理大型项目的堆空间

  2. 如果您喜欢非gui方式,这总是更可靠,这是我从我的一个项目中附加的示例gradle.properties文件注意,1024m指定了要提供给JVM用于堆存储的RAM数量(1024MB)。你的情况可以翻倍,也就是。2048M甚至三倍

# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
org.gradle.daemon=true
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx7g -XX:MaxPermSize=1024m -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
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app's APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true

相关内容

最新更新