Android Studio 4 无法检测到 Java 代码,并且无法打开 SDK 管理器和设置。

huangapple go评论83阅读模式
英文:

Android Studio 4 cannot detect java code and Cannot open SDK Manager,Settings

问题

以下是翻译好的部分:

我刚刚更新到了最新版本的Android Studio,并且执行了“无效缓存并重启”的操作,但在此之后,我的项目文件全部显示为红色,Android Studio 无法检测到Java。每当我将鼠标悬停在红线上时,会显示“配置JDK”选项。我已经从Oracle网站下载了最新的JDK,并在Java路径中选择了它,但仍然无法解决问题。我无法打开设置、SDK管理器,也无法配置SDK。

下面是错误对话框的截图

Android Studio 4 无法检测到 Java 代码,并且无法打开 SDK 管理器和设置。

我尝试了下面的所有选项,但问题仍然无法解决

Android Studio 4 无法检测到 Java 代码,并且无法打开 SDK 管理器和设置。

英文:

I just updated to latest android studio and had invalidated caches and restart but after that my project files are all red and android studio cannot detect java.
Whenever I hover on red line, It shows a configure JDK option.
I had downloaded latest jdk from oracle website and selected that in java path but that also didn't work. I am not able to open settings, SDK manager, neither can I configure SDK.

> Below is the error dialog

Android Studio 4 无法检测到 Java 代码,并且无法打开 SDK 管理器和设置。

> I tried all the options below but cannot solve the issue

Android Studio 4 无法检测到 Java 代码,并且无法打开 SDK 管理器和设置。

答案1

得分: 6

在我的情况下是CSV插件出了问题。
在我注意到状态栏右侧有一个错误提示说CSV插件启动失败后,我在“报告问题”对话框中禁用了这个插件。
然后重新启动Android Studio就能解决无法打开设置的问题。

英文:

In my case is the CSV Plugin's fault.
After I noticed en error in the right of the status bar said that CSV plugin startup failed, then I disabled this plugin in the Report Issue dialog
Then restart Android Studio will fix the cannot open settings problem

plugin

答案2

得分: 0

我认为你还没有设置JDK。尝试设置JDK,我认为这会帮助你解决问题。

英文:

I think you have not setup JDK.Try to setup JDK and i think it will help you to solve the problem.

答案3

得分: 0

Finally after hours of debugging, here is how I solved all the issues.

> 问题的原因:更新不当

  1. 检查了 IDE 日志,显示一个插件抛出的异常。所以我卸载了那个插件。
  2. 删除了旧文件夹 C\Users\<Username>\ 中的 Android Studio 旧版本文件夹 .Android-studio-3.6
  3. 大部分错误消失了,但是 Android Studio 显示了一个警告 为构建 Gradle 选择了两个不同的 JDK 位置...,所以我打开控制面板,删除了除了我从 Oracle 网站 下载的最新 JDK 14.0.1 之外的所有旧版本 Java
  4. 仍然显示相同的错误,所以我从 官网 下载了 Android Studio 4.0 的可执行文件,并进行了 重新安装。在重新安装时,我没有选择安装 Android 虚拟设备,因为它已经安装好了。
英文:

Finally after hours of debugging , here is how I solved all the issues.

> Cause of the problem : Improper Update

  1. Checked IDE log, which was showing an exception thrown by a plugin. So I uninstalled that plugin.
  2. Deleted old folder of android studio .Android-studio-3.6 present inside C\Users\<Username>\
  3. Most of the errors were gone but android studio was shwowing a warning "Two different JDK locations are selected for building gradle....", so I went to control panel and deleted all old versions of java except for the latest JDK 14.0.1 which I downloaded from Oracle website.
  4. Still it was showing the same error so I downloaded Android Studio 4.0 exe file from their website and re-installed Android studio. While Reinstalling, I did not select Android Virtual device as it was already installed.

huangapple
  • 本文由 发表于 2020年5月29日 20:52:07
  • 转载请务必保留本文链接:https://go.coder-hub.com/62086475.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定