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


当前回答

不要编辑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.

其他回答

我也有同样的问题,用这种方式解决:

你应该从苹果官方页面安装Java。

http://support.apple.com/kb/DL1572

当我更新到OS X El Capitan时,Java被卸载了。

重新安装Java前后的终端截图。

要重新安装Java,我遵循Android Studio对话框中提供的链接。

重新安装Java后,Android Studio再次运行。

安装最新的JDK (8u102 current) 设置环境变量STUDIO_JDK (java_home输出Java主目录,sed剥离两个文件夹以获得jdk目录) /usr/libexec/java_home -version 1.8 | sed 's/\/Contents\/Home//g' ' 像往常一样启动Android Studio

在每次重启时设置STUDIO_JDK

以上步骤仅适用于当前会话。下面是如何在/Library/LaunchDaemons中创建一个plist文件,在每次引导时运行上面的命令:

sudo defaults write /Library/LaunchDaemons/com.google.studiojdk Label STUDIO_JDK
sudo defaults write /Library/LaunchDaemons/com.google.studiojdk ProgramArguments -array /bin/launchctl setenv STUDIO_JDK `/usr/libexec/java_home | sed 's/\/Contents\/Home//g'`
sudo defaults write /Library/LaunchDaemons/com.google.studiojdk RunAtLoad -bool TRUE

要知道plist的诀窍,请访问http://www.dowdandassociates.com/blog/content/howto-set-an-environment-variable-in-mac-os-x-launchd-plist/

注意,最后一个变量允许你在OSX上运行带有Java 7的Android Studio(通常从Info.plist中指定的版本中选择Java 6):

$ export STUDIO_JDK=/Library/Java/JavaVirtualMachines/jdk1.7.0_67.jdk

$ open /Applications/Android\ Studio.app

为我工作

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

编辑:

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

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

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

谢谢aried3r !