如何在 AndroidStudio 中设置 Java SDK 路径? [英] How to set Java SDK path in AndroidStudio?

查看:277
本文介绍了如何在 AndroidStudio 中设置 Java SDK 路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我安装了 Java 1.7.0_21,今天在卸载以前的版本后安装了 1.7.0_45.现在Android Studio 已经停止编译项目并说它找不到1.7.0_21 文件夹.如何为 Java SDK 设置新路径?我也更改了环境变量,但没有用.

I had Java 1.7.0_21 installed and I installed 1.7.0_45 today after uninstalling the previous version. Now Android Studio has stopped compiling projects and says that it cant locate the 1.7.0_21 folder. How can I set the new path for Java SDK? I have changed the environment variables also but didn't work.

推荐答案

最高 Android Studio 4.2

转到文件>项目结构SDK 位置.第三个字段是JDK Location".你可以在哪里设置它.这将为当前项目设置它.

Up to Android Studio 4.2

Go to File > Project Structure > SDK Location. The third field is "JDK Location" where you can set it. This will set it for the current project.

要为新项目设置默认值,请转到 文件 >其他设置 >默认项目结构 >SDK 位置并设置JDK位置".

To set the default for new projects, go to File > Other Settings > Default Project Structure > SDK Location and set the "JDK Location".

Android Studio Arctic Fox (2020.3.1) 的 Canary 14 中,JDK Location 设置移至:

In the Canary 14 of Android Studio Arctic Fox (2020.3.1), the JDK Location setting is moved to:

Settings > Build, Execution, Deployment > Build Tools > Gradle > Gradle JDK

旧版本

转到文件>项目结构[平台设置] >SDK.您需要更新当前的 SDK 配置以使用新目录,或者定义一个新目录,然后更改项目设置以使用新目录.这将为当前项目设置它.

Older Versions

Go to File > Project Structure > [Platform Settings] > SDKs. You'll need to either update you current SDK configuration to use the new directory, or define a new one and then change your project's settings to use the new one. This will set it for the current project.

要为新项目设置默认值,请转到 文件 >其他设置 >新项目的结构 >[平台设置] >SDKs 并设置要在创建新项目时使用的 SDK.

To set the default for new projects, go to File > Other Settings > Structure for New Projects > [Platform Settings] > SDKs and set the SDK to use when creating a new project.

这篇关于如何在 AndroidStudio 中设置 Java SDK 路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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