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以后項目就好使了哈哈

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM