Android studio gradle编译无法初始化jvm 提示unrecognized jvm option is used
gradle编译遇到无法初始化jvm 提示 unrecognized jvm option is used解决方案
gradle编译遇到无法初始化jvm 遇到以下错误:
Gradle sync failed: 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/5.4.1/userguide/gradle_daemon.html Process command line: D:\Android\android-studio3.5\android-studio\jre\bin\java.exe -Xmx4608M -Dfile.encoding=GBK -Duser.country=CN -Duser.language=zh -Duser.variant -cp C:\Users\Administrator.gradle\wrapper\dists\gradle-5.4.1-all\3221gyojl5jsh0helicew7rwx\gradle-5.4.1\lib\gradle-launcher-5.4.1.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 5.4.1 Please read the following process output to find out more: ----------------------- Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit. Invalid maximum heap size: -Xmx4608M The specified size exceeds the maximum representable size. (2 s 421 ms)
解决方案:
在以下文件夹( (C:\Users\username.gradle 或 ~.gradle))下创建gradle.properties文件,添加
org.gradle.jvmargs=-Xmx1024m -XX:MaxPermSize=256m 如果以前有org.gradle.jvmargs 替换以前的即可
参数可以根据自己的需要设置jvm -Xmx的大小
|