Android Studio - 无法识别的 VM 选项“MaxPermSize=256m" [英] Android Studio - Unrecognized VM option 'MaxPermSize=256m'

查看:595
本文介绍了Android Studio - 无法识别的 VM 选项“MaxPermSize=256m"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚在 Elementary OS 0.3 Freya 上安装了 Android Studio 并使用终端运行它.但是,在我第一次启动时,显示了一条错误消息:

I just installed Android Studio on Elementary OS 0.3 Freya and run it using the terminal. On my first start-up, however, there's an error message shown:

Gradle 'Test' 项目刷新失败

Gradle 'Test' project refresh failed

无法启动守护进程.这个问题可能是由守护进程的配置不正确.例如,一个无法识别的使用 jvm 选项.请参阅用户指南章节守护进程在 http://gradle.org/docs/2.2.1/userguide/gradle_daemon.html请阅读以下流程输出以了解更多信息:

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 guide chapter on the daemon at http://gradle.org/docs/2.2.1/userguide/gradle_daemon.html Please read the following process output to find out more:

无法识别的 VM 选项MaxPermSize=256m"错误:无法创建Java虚拟机.错误:发生了致命异常.程序将退出.

Unrecognized VM option 'MaxPermSize=256m' Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit.

我阅读了这个并尝试了所有方法来解决它,但无济于事.我确实注意到他的错误与我的有些不同,并认为这可能是我无法使用建议的方法解决我的问题的原因.

I read this and tried all the ways to solve it but to no avail. I did notice that his error was somewhat different from mine and thought that might be why I couldn't solve my problem using the ways suggested.

当我在终端上执行 .sh 文件时,它打印:

As I executed the .sh file on my terminal, it printed:

Java HotSpot(TM) 服务器 VM 警告:忽略选项 MaxPermSize=250m;8.0 中移除了支持

Java HotSpot(TM) Server VM warning: ignoring option MaxPermSize=250m; support was removed in 8.0

(java:5094): Gtk-WARNING **: 无法找到主题引擎模块路径:像素图"

(java:5094): Gtk-WARNING **: Unable to locate theme engine in module_path: "pixmap"

Gtk-消息:无法加载模块canberra-gtk-module"

Gtk-Message: Failed to load module "canberra-gtk-module"

我不确定它是否与错误有关.请帮忙.

I'm not sure whether it's related to the error or not. Please help.

推荐答案

正如在这个线程中已经说过的,在 Java 8 中删除了永久代,在您的情况下使用.我认为,最简单的解决方案是在程序执行过程中移除与永久代相关的参数.

As it was already said in this thread, Permanent Generation was removed in Java 8, which is used in your case. I think, the easiest solution is to remove parameters associated with Permanent Generation during program execution.

转到您拥有 Android Studio 的目录.然后转到 bin/ 子目录.找到以下文件,其中包含 Java 虚拟机选项:

Go to the directory where you have Android Studio. Then go to the bin/ subdirectory. Locate the following files, which contains Java Virtual Machine options:

  • studio.vmoptions
  • studio64.vmoptions

打开这些文件并找到带有 MaxPerSize 参数的行.它应该如下所示:

Open these files and locate line with MaxPerSize parameter. It should look as follows:

XX:MaxPermSize=256m

删除这两个文件中的这一行.我不知道您使用的是 32 位还是 64 位操作系统,因此您可以更新这两个文件以防万一.

Remove this line in both files. I don't know if you are using 32-bit or 64-bit operating system, so you can update both files just in case.

我不确定它是否能解决您的问题,但我会在这种情况下尝试.就我而言,使用此选项和 ​​Java 8,我只会收到警告,但 Android Studio 无论如何都会启动.去掉这个参数后,Android Studio 仍然启动,但没有警告.我使用的是 Ubuntu 14.04 LTS.

I'm not sure if it will solve your problem, but I would try it in such situation. In my case, with this option and Java 8, I just get the warning, but Android Studio starts anyway. After removing this parameter, Android Studio still starts, but without warning. I'm using Ubuntu 14.04 LTS.

编辑:

此处描述了针对此问题的另一种解决方案:https://stackoverflow.com/a/27913562/1150795.

There is another solution for this problem described here: https://stackoverflow.com/a/27913562/1150795.

转到文件>其他设置>默认项目结构>JDK位置并检查路径.

对于 Ubuntu Linux,如果我们使用 Oracle JVM,我们可以将 /usr/lib/jvm/java-7-oracle 设置为默认 JDK.JDK 7 是 Android 最安全的选择.

In case of Ubuntu Linux, we can set /usr/lib/jvm/java-7-oracle as default JDK if we are using Oracle JVM. JDK 7 is the safest option for Android.

这篇关于Android Studio - 无法识别的 VM 选项“MaxPermSize=256m"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆