Android Studio 2.2.预览1错误:“请使用JDK 8或更高版本"; [英] Android Studio 2.2. Preview 1 error: "Please use JDK 8 or newer"

查看:364
本文介绍了Android Studio 2.2.预览1错误:“请使用JDK 8或更高版本";的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在尝试运行Android Studio 2.2预览版1时,它在gradle构建中出现以下错误:

On trying to run Android Studio 2.2 Preview 1, it gives the following error on gradle build:

错误:请使用JDK 8或更高版本.

Error:Please use JDK 8 or newer.

如果我尝试从控制台进行操作,则会显示:

If I try and do it from the console it says:

失败:构建失败,并出现异常.

FAILURE: Build failed with an exception.

  • 其中:构建文件'C:\ Coding \ Android projects \ MaterialScrollBar \ app \ build.gradle'行:1

  • Where: Build file 'C:\Coding\Android projects\MaterialScrollBar\app\build.gradle' line: 1

出了什么问题:评估项目':app'时出现问题. com/android/jack/api/ConfigNotSupportedException:不受支持的major.minor版本52.0

What went wrong: A problem occurred evaluating project ':app'. com/android/jack/api/ConfigNotSupportedException : Unsupported major.minor version 52.0

我试图将JDK的建议从jdk 1.7更改为1.8,但是每次我将项目的JDK位置更改为除当前路径以外的任何其他路径时,都会立即将其重置.即使我将其更改为其他版本的1.7,它也不会更改.

I've tried to change the JDK as it suggests from jdk 1.7 to 1.8, but each time I change the JDK location for the project to any other path than the one it currently has it resets back immediately. Even if I change it to other versions of 1.7 it won't change.

我已经验证了环境变量都指向1.8,但仍然没有骰子. AS 2.1将同一项目的JDK识别为1.8.

I've verified that the environmental variables all point to 1.8 and still no dice. AS 2.1 recognises the JDK as 1.8 for the same project.

推荐答案

我在Android Studio的早期版本中遇到了此问题.首次安装Android Studio时,我可以在程序文件"目录中引用JDK 7.

I ran into this issue with a previous version of Android Studio. When I first installed Android Studio I was able to reference JDK 7 in my Program Files directory.

当我升级Android Studio并尝试对其进行更新以指向JDK 8时(也位于我的Program Files目录中),我得到了与您所看到的相同的行为.新路径从未使用过,仍然使用了JDK 7.

When I upgraded Android Studio and tried to update it to point to JDK 8, which was also in my Program Files directory, I got the same behavior you are seeing. The new path never took and it still used JDK 7.

结果表明,Android Studio不喜欢Android SDK和JDK路径中的空格.在不包含任何空格的位置安装JDK,使我可以通过项目结构"窗口来更新位置.

Turns out Android Studio does not like spaces in the paths to the Android SDK and the JDK. Installing the JDK in a location that does not contain any spaces allowed me to update the location through the Project Structure window.

这篇关于Android Studio 2.2.预览1错误:“请使用JDK 8或更高版本";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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