我无法在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.
其他回答
AndroidStudio将从文件~/Library/Preferences/AndroidStudio/idea.properties中读取设置。我创建了这个文件,其中有我的jdk的路径:
STUDIO_JDK=/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk
不编辑信息。plist必要!
(更新) 这在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,看这里
注意,最后一个变量允许你在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
为我工作
我下载了Intellij Idea。当我尝试安装Intellij时,弹出提示我的Mac缺少Java RE,你想下载吗?我用Intellij下载了丢失的包后,就可以打开Android Studio了。
把这个家伙装在这里
http://support.apple.com/kb/DL1572?viewlocale=en_US&locale=en_US
你应该很好。
推荐文章
- 从Cocoa应用程序执行一个终端命令
- Android命令行工具sdkmanager总是显示:警告:无法创建设置
- 为什么Java类的编译与空行不同?
- 如何设置RecyclerView应用程序:layoutManager=""从XML?
- 在没有开发服务器的情况下在设备上构建和安装unsigned apk ?
- 操作栏和新引入的工具栏有什么不同?
- 调整浮动动作按钮图标大小(fab)
- Android Studio无法找到有效的Jvm(与MAC OS相关)
- 为什么一个组合器需要减少方法转换类型在java 8
- CountDownLatch是如何在Java多线程中使用的?
- 如果我同步了同一个类上的两个方法,它们能同时运行吗?
- 如何减去X天从一个日期对象在Java?
- Java标识符中的“连接字符”是什么?
- android:在触摸移动时移动视图
- 如何以编程方式将ID分配给视图?