如何在android studio中指定JDK版本? [英] How to specify the JDK version in android studio?

查看:6022
本文介绍了如何在android studio中指定JDK版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 错误:(3,22)compileSdkVersion android-22需要用JDK 7编译

现在它给了我这些可点击的提示:

 下载JDK 7 
从文件系统中选择一个JDK
打开build.gradle文件

而且我已经下载并安装了JDK 7.问题是当我在文件系统中选择它时,我只能找到一个名为1.6.0 JDK的目录。此外,JDK 7的安装跳过了我将选择安装目录的要点,所以我真的不确定它在哪里。我的Java控制面板说我有Java 7更新79,所以我很确定我很近,我只需要告诉android工作室它在哪里。我还在终端中运行了java -version命令,它说我的版本是1.7.0_79。



任何帮助都会被赞赏!

$ b $对于Mac或 Ctrl +,您可以使用 cmd + ; + 对于Windows / Linux, Alt + Shift + S 可以打开Project Structure对话框。在那里,您可以设置JDK位置以及Android SDK的位置。


要获取您的JDK位置,请在终端中运行 / usr / libexec / java_home -v 1.7 。发送1.7 for Java 7或1.8 for Java 8。


so Android Studio is giving me a Gradle build error that looks like this:

Error:(3, 22) compileSdkVersion android-22 requires compiling with JDK 7

Now it gives me these clickable prompts:

Download JDK 7
Select a JDK from the File System
Open build.gradle File

And I have already downloaded and installed JDK 7. The problem is when I go to select it in the "File System" i can only find a directory named 1.6.0 JDK. Furthermore, the installation of JDK 7 skipped the bullet point where I would've selected the install directory, so I'm really not sure where it is. My java control panel says Ihave "Java 7 Update 79" so I'm pretty sure I'm close, I just need to tell android studio where it is. I also ran the java -version command in the terminal and it says my version is "1.7.0_79".

Any help is appreciated!

解决方案

You can use cmd + ; for Mac or Ctrl + Alt + Shift + S for Windows/Linux to pull up the Project Structure dialog. In there, you can set the JDK location as well as the Android SDK location.

To get your JDK location, run /usr/libexec/java_home -v 1.7 in terminal. Send 1.7 for Java 7 or 1.8 for Java 8.

这篇关于如何在android studio中指定JDK版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆