'android-24' 需要 JDK 1.8 或更高版本才能编译 [英] 'android-24' requires JDK 1.8 or later to compile
问题描述
我使用 Android Studio,最近遇到了错误:
I use Android Studio and recently got the error:
错误:任务:app:compileDebugJavaWithJavac"的执行失败.compileSdkVersion 'android-24' 需要 JDK 1.8 或更高版本才能编译.
Error:Execution failed for task ':app:compileDebugJavaWithJavac'. compileSdkVersion 'android-24' requires JDK 1.8 or later to compile.
但我已经安装了 JDK 1.8:
But I have JDK 1.8 installed already:
:\Users..>java -version
java 版本1.8.0_91"Java(TM) SE 运行时
环境(构建 1.8.0_91-b15)Java HotSpot(TM) 64 位服务器 VM
(构建 25.91-b15,混合模式)
:\Users..>java -version
java version "1.8.0_91" Java(TM) SE Runtime
Environment (build 1.8.0_91-b15) Java HotSpot(TM) 64-Bit Server VM
(build 25.91-b15, mixed mode)
如何解决?谢谢
推荐答案
在Android Studio中打开:File
> Project Structure
> 查看 JDK 位置是否指向您的 JDK 1.8 目录.
In Android Studio open:
File
> Project Structure
> see if JDK location points to your JDK 1.8 directory.
注意:你可以使用compileSdkVersion 24
这篇关于'android-24' 需要 JDK 1.8 或更高版本才能编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!