安卓工作室 2.2.预览 1 错误:“请使用 JDK 8 或更新版本" [英] Android Studio 2.2. Preview 1 error: "Please use JDK 8 or newer"

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

问题描述

在尝试运行 Android Studio 2.2 Preview 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:构建失败,出现异常.

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 时,我能够在我的 Program Files 目录中引用 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.

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

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