错误:compileSdkVersion的android-21需要与JDK 7编译错误、compileSdkVersion、android、JDK

2023-09-12 22:07:36 作者:全幼儿园最帅

在编译时出现错误错误:compileSdkVersion的android-21需要与JDK 7编译,说JDK的更新版本,需要

While compiling i get the error Error:compileSdkVersion android-21 requires compiling with JDK 7, saying that a newer version of JDK is required.

我在OS X上运行的优胜美地与Android工作室v0.8.14

I'm running on OS X Yosemite with Android Studio v0.8.14

东西:

Java版本:

Java版本1.8.0_25 的Java(TM)SE运行时环境(建设1.8.0_25-B17) Java的热点(TM)64位服务器虚拟机(建设25.25-B02,混合模式),

java version "1.8.0_25" Java(TM) SE Runtime Environment (build 1.8.0_25-b17) Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)

在JavaVirtualMachine文件夹,我只能看到 1.6.0.jdk 文件夹,我找不到任何其他文件夹。

Inside the JavaVirtualMachine folder I can see only 1.6.0.jdk folder, I cannot find any other folder.

尝试重新安装JDK 8和7!

Tried reinstalling JDk 8 and 7!

我无法找到JVM 1.8的文件夹位置,任何想法如何,我可以解决那里。

I'm unable to find the folder location of jvm 1.8, any idea how I can fix there.

推荐答案

的精确修复此问题(Android的工作室Mac用户)

如果您已经升级到Java 8,请注意JDK的位置现在是在 /库/ Java的相比,Java 6的位置 /系统/库/ Java的。因此,要解决此问题,右键点击 Project文件夹> 项目结构> SDK位置。

If you have already upgraded to Java 8, please note that the JDK location is now within /Library/Java compared to Java 6's location /System/Library/Java. So to fix this problem, Right click on the Project folder > Project Structure > SDK Location.

然后换JDK位置

/Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home

如果您已经安装了一个不同的JDK版本(不是Java 8等),找出使用 JAVA_HOME 脚本路径优先和使用的输出。只要运行,

If you have installed a different JDK version (other than Java 8), find out the path using the java_home script first and use the output. Just run,

/usr/libexec/java_home