我无法在Mac OS上启动我的Android Studio进行Android开发(10.10.1 - Yosemite)
当前回答
我运行了这个坏小子:
launchctl setenv STUDIO_JDK /Library/Java/JavaVirtualMachines/jdk1.7.0_71.jdk/
其他回答
我也有同样的问题,用这种方式解决:
你应该从苹果官方页面安装Java。
http://support.apple.com/kb/DL1572
在Info.plist中更改此键
我从
<key>JVMVersion</key>
<string>1.6*</string>
to
<key>JVMVersion</key>
<string>1.8*</string>
现在它工作得很好。
编辑: 根据hasternet和aried3r上面提到的官方声明,Antonio Jose的解决方案是正确的。
谢谢!
编辑android工作室的信息。plist文件,以便它使用1.7或任何您已经安装的JVMVersion。将JVMVersion更改为1.6+而不是如上所述的hassternet回答的1.6*应该也可以工作。
上述工作,但不建议参阅RC3发行说明
As of RC 3, we have a better mechanism for customizing properties for the launchers on all three platforms. You should not edit any files in the IDE installation directory. Instead, you can customize the attributes by creating your own .properties or .vmoptions files in the following directories. (This has been possible on some platforms before, but it required you to copy and change the entire contents of the files. With the latest changes these properties are now additive instead such that you can set just the attributes you care about, and the rest will use the defaults from the IDE installation).
Android Studio无法在Mac OSX上加载JVM (Mavericks)
正如@Gerard的建议,我总结了我的原始评论(https://stackoverflow.com/a/27370525/763459)作为答案,希望它能帮助其他被这个问题困扰的人。
有一种不运行AppleScript的方法: 编辑.bash_profile(如果这个文件不存在,请创建一个新的文件,就像@Gerard建议的那样,你可以第一次使用源文件.bash_profile)。
安装遗留Java(可能需要)http://support.apple.com/kb/DL1572 输入export STUDIO_JDK /Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk 然后退出终端(或任何你用来编辑这个文件的文本编辑器),运行Android Studio和viola
在OSX 10.10和Android 1.0.1上测试
(更新) 这在Android Studio 1.1中得到了修复 https://issuetracker.google.com/issues/37015035
在下一个版本的Android Studio中,如果没有找到java 6,但找到了java 7(或更高),那么它将使用java 6。我们仍然推荐使用Java 6运行studio,因为它改进了字体渲染,但是如果只找到Java 8,就不需要做任何工作。
(最后更新)
从Android Studio 1.0 RC3 Notes
As of RC 3, we have a better mechanism for customizing properties for the launchers on all three platforms. You should not edit any files in the IDE installation directory. Instead, you can customize the attributes by creating your own .properties or .vmoptions files in the following directories. (This has been possible on some platforms before, but it required you to copy and change the entire contents of the files. With the latest changes these properties are now additive instead such that you can set just the attributes you care about, and the rest will use the defaults from the IDE installation).
然而,没有解释什么是选项。
找了一会儿,我找到了这个 在Mac上调整Android Studio的虚拟机选项 IntelliJ IDEA 14.0.0 Web帮助/文件IDEA。属性
然而,运气不佳。
幸运的是,我能够像1.0 RC3发行说明中所说的那样,使用环境变量在优胜美地解决这个问题。
你也可以把使用环境变量放在其他地方指向特定的覆盖文件: STUDIO_VM_OPTIONS,使用哪个vmoptions文件 STUDIO_PROPERTIES,使用哪个属性文件 STUDIO_JDK,用于运行studio的JDK
这有点棘手,因为Android Studio不是一个命令行应用程序,所以我必须使用AppleScript命令来设置登录时的环境变量。更多信息请点击这里
这是命令行的launchctl命令。
launchctl setenv STUDIO_JDK /Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk
这是我的AppleScript(记得保存为应用程序)
do shell script "launchctl setenv STUDIO_JDK /Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk"
关于launchctl,看这里
推荐文章
- 如何在Java中打印二叉树图?
- 按钮背景是透明的
- String.format()在Java中格式化双重格式
- 在Mac OS X上哪里安装Android SDK ?
- 我如何获得图像缩放功能?
- 在Android应用程序中显示当前时间和日期
- com.jcraft.jsch.JSchException: UnknownHostKey
- Java中的操作符重载
- 如何加速gwt编译器?
- 在Hibernate中重新连接分离对象的正确方法是什么?
- 应该……接住环内还是环外?
- BottomSheetDialogFragment的圆角
- 在应用程序启动时出现“无法获得BatchedBridge,请确保您的bundle被正确打包”的错误
- Mac/OS X上的/var/lib/docker在哪里
- 我如何改变默认对话框按钮的文本颜色在安卓5