IntelliJ Cannot find declaration to go to----解决方案

时间:2020-05-29
本文章向大家介绍IntelliJ Cannot find declaration to go to----解决方案,主要包括IntelliJ Cannot find declaration to go to----解决方案使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。

从git上拉取下来项目以后,每个class文件图标都是灰色的,进去里面ctrl+鼠标左键跳转不了别的类,而且系统中有这些类,却一直提示 Cannot find declaration to go to。

百度了很多方法,什么关掉当前项目然后重新import啊,什么项目右键Mark directory as --> Sources root之类的通通不管用。

直到看到了这个方法,在此记录一下,日后慢慢研究。

原文链接:https://www.cnblogs.com/ShaYeBlog/p/11250035.html

附上解决方法:

  1. close the project in intellij.    关闭当前idea中的项目
  2. close intellij.    关闭idea
  3. go to the project folder and delete the .idea folder    前往项目的文件夹中删除.idea文件夹
  4. restart intellij and open the project (wait for the indexing to finish) and it would work.    重新启动idea并且打开修改后的项目等index更新完成就可以了

其实本人我的操作是直接去文件夹里把.idea文件删了,然后再file -> InvalidateCaches/restart -> InvalidateCaches/restart重启完idea以后项目就好使了哈哈

原文地址:https://www.cnblogs.com/sapoo/p/12988726.html