我无法在Mac OS上启动我的Android Studio进行Android开发(10.10.1 - Yosemite)


当前回答

在finder中打开Android Studio的应用程序包,并编辑信息。plist文件。修改密钥JVMversion。用1.6+代替1.6*。这招对我很管用!

编辑:

虽然这在旧版本的Android Studio中是必要的,但不再推荐这样做。详见官方声明

"请注意:不要编辑信息。请选择一个不同的版本。这不仅会破坏应用程序的签名,还会破坏未来的补丁更新。”

安东尼奥•何塞的答案是正确的。

谢谢aried3r !

其他回答

不要编辑plist。这些说明在我几个月前第一次安装Android Studio时起了作用,就在今天。(1/21/2015)

你所需要做的只是几件简单的事情,尽管谷歌的网站上并没有列出。

First you need Java installed. this is not the JDK, it is seperate. You can get that from this link. If you don't have this it will probably throw an error saying something like "no JVM installed." Second you need the Java JDK, I got JDK 7 from this link. Make sure to choose the Mac OS X link under the Java SE Development Kit 7u75 heading. If you don't have this it will probably throw an error saying something like "no JDK installed." If you haven't already installed Android Studio, do that. But I'm sure you've already done that by now.

您可以使用用户的启动代理来实现STUDIO_JDK解决方案。这涉及到在您的LaunchAgents目录中创建一个plist文件,位于~/Library/LaunchAgents

创建一个新文件~/Library/LaunchAgents/UNIQUE_KEY。其中UNIQUE_KEY只是一个标识符。我使用com.username.androidstudio。

将以下文本复制到新的plist文件中,并根据下面的说明修改它。

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
   <key>Label</key>
   <string>UNIQUE_KEY</string>
   <key>ProgramArguments</key>
   <array>
      <string>sh</string>
      <string>-c</string>
      <string>launchctl setenv STUDIO_JDK /Library/Java/JavaVirtualMachines/jdk1.7.0_71.jdk</string>
   </array>
   <key>RunAtLoad</key>
   <true/>
</dict>
</plist>

你需要做两个修改:

更改UNIQUE_KEY以匹配您的文件名(不带.plist扩展名)。 验证您的JDK路径是否正确,并在必要时进行更改。在本例中,我使用7u71。

这和安东尼奥·何塞的答案是一样的。它根据Android Studio版本1.0 RC3发布说明设置STUDIO_JDK环境变量。这个解决方案使用LaunchAgents目录而不是AppleScript来设置环境变量。因此,这主要是您如何安排和组织系统和环境变量的差异。

在finder中打开Android Studio的应用程序包,并编辑信息。plist文件。修改密钥JVMversion。用1.6+代替1.6*。这招对我很管用!

编辑:

虽然这在旧版本的Android Studio中是必要的,但不再推荐这样做。详见官方声明

"请注意:不要编辑信息。请选择一个不同的版本。这不仅会破坏应用程序的签名,还会破坏未来的补丁更新。”

安东尼奥•何塞的答案是正确的。

谢谢aried3r !

我通过更改信息中的JVM版本解决了这个问题。Plist文件到1.7*

AndroidStudio将从文件~/Library/Preferences/AndroidStudio/idea.properties中读取设置。我创建了这个文件,其中有我的jdk的路径:

STUDIO_JDK=/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk

不编辑信息。plist必要!