简体   繁体   English

Android Studio 无法识别 JDK

[英]Android Studio doesn't recognize JDK

My Android Studio suddenly stopped recognizing JDK.我的 Android Studio 突然停止识别 JDK。 it starts fine with no error messages.它开始正常,没有错误消息。 I have JDK 1,7 (x86 version) on windows 8.1.我在 Windows 8.1 上有 JDK 1,7(x86 版本)。 Environment variable is defined in the system variables and I can run java -version command from cmd with no issue.环境变量在系统变量中定义,我可以毫无问题地从 cmd 运行 java -version 命令。 following screen shot describe the problem clearly:以下屏幕截图清楚地描述了问题:在此处输入图片说明

You may need to check if both JDK and SDK are set correctly.您可能需要检查 JDK 和 SDK 是否设置正确。

In the current project :当前项目中

  • Go to File > Project Structure..转到文件>项目结构..
  • Explore the sections " Android SDK Location " and " JDK Location " (Put the complete paths)探索“ Android SDK 位置”和“ JDK 位置”部分(放置完整路径)
  • Click OK to save changes单击确定保存更改

For projects default :对于项目默认

  • Close current Project (File > Close project)关闭当前项目(文件 > 关闭项目)
  • Click on Configure > Project Defaults > Project Structure单击配置 > 项目默认值 > 项目结构
  • Explore the sections " Android SDK Location " and " JDK Location " (Put the complete paths)探索“ Android SDK 位置”和“ JDK 位置”部分(放置完整路径)
  • Click OK to save changes单击确定保存更改

Restart Android Studio and try again.重新启动 Android Studio 并重试。

Screenshot: http://i.imgur.com/0OD8OeJ.png (I cannot post images directly)截图: http : //i.imgur.com/0OD8OeJ.png (不能直接发图)

After spending one night trying to solve this problem, i just did as suggested by yole花了一晚试图解决这个问题后,我只是按照yole 的建议做了

So Simple : File ----> Invalidate.如此简单:文件 ----> 无效。

I had the same problem after upgrading to build tool 22.0.1.升级到构建工具 22.0.1 后,我遇到了同样的问题。 I solved this issue by removing dependencies and adding it again like app-compact and play services.我通过删除依赖项并再次添加它来解决这个问题,比如 app-compact 和 play 服务。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM