我无法在Mac OS上启动我的Android Studio进行Android开发(10.10.1 - Yosemite)
当前回答
(更新) 这在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,看这里
其他回答
把这个家伙装在这里
http://support.apple.com/kb/DL1572?viewlocale=en_US&locale=en_US
你应该很好。
不要编辑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.
尝试从Apple Support Page: http://support.apple.com/kb/DL1572下载Java,如果这对你来说不起作用或无法加载(非常常见的问题),只需按照这个链接下载并安装你需要的Java版本:
http://support.apple.com/downloads/DL1572/en_US/JavaForOSX2014-001.dmg
就是这样。
“在Mac OS上,运行带有Java运行时环境(JRE) 6的Android Studio,以优化字体渲染。然后,您可以配置您的项目使用Java开发工具包(JDK) 6或JDK 7。”
这是在Mac OS X系统要求下的http://developer.android.com/sdk/index.html中列出的。
一旦你按照Alonso C. Licks从苹果安装了Java 6(而不是JDK),你应该能够打开Android Studio并重新配置,而不必在终端中混乱,信息。Plist文件或其他库。
作为一个新手用户,我花了一段时间来理解如何以正确的方式修复这个问题。在搜索和低估了许多关于SO的答案后,我想出了以下步骤,你需要遵循来解决这个问题。
请注意:
尽管最简单的解决方案是更新Info。android studio的Plist。但不建议这样做,也不是正确的修复方法。
官方声明-“请注意:不要编辑信息。请选择一个不同的版本。这不仅会破坏应用程序的签名,还会破坏未来的补丁更新。”
第一个解决方案:如果你从命令行运行Android Studio,你可以将这两行添加到你的.bash_profile中
$ export STUDIO_JDK=/Library/Java/JavaVirtualMachines/jdk1.7.0_67.jdk
$ open /Applications/Android\ Studio.app
从下次你打开你的终端,你的工作室将自动开始。
第二个解决方案:如果你想从UI(点击图标)运行Android Studio,请遵循以下步骤:
在mac上打开脚本编辑器(可以在spotlight中找到它) 复制到下面一行 执行shell脚本“launchctl setenv STUDIO_JDK /Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk”
注意:—请根据实际版本修改jdk版本。要检查您使用的是开放终端的哪个版本,请运行以下命令
java -version
3.现在保存(⌘+s)为文件格式:应用程序。最后打开系统设置→用户和组→登录项,添加刚刚创建的新应用程序。
注销和登录再次或您可以手动运行该应用程序以及..
woolaaaa ...对抗自由我们还。
引用:
安东尼奥·何塞的回答
ruario的回答
推荐文章
- 如何在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