Intellij Cannot resolve symbol on import

前端 未结 29 1755
耶瑟儿~
耶瑟儿~ 2020-11-30 18:10

This problem happens intermittently for different libraries and different projects. When trying to import a library, the package will be recognized, but the class name can\'

相关标签:
29条回答
  • 2020-11-30 18:50

    Nothing I tried above worked for me (not that I tried every suggestion). What finally did the trick was to rename the class -- I just added a 2 to the class name and filename. Then I resolved all the references manually. (Since they weren't recognized, the refactoring did not change the references automatically.)

    Once the "2-version" was happily resolved everywhere, I was then able to refactor and remove the 2 from the class and file, and everything was then as it should be.

    0 讨论(0)
  • 2020-11-30 18:50

    For 2020.1.4 Ultimate edition, I had to do the following

    View -> Maven -> Generate Sources and Update Folders For all Projects

    The issue for me was the libraries were not getting populated with mvn -U clean install from the terminal.

    0 讨论(0)
  • 2020-11-30 18:51

    Run this command in your project console:

    mvn idea:idea
    

    Done. Had this issue many times. Tried 'Invalidate Cache & Restart' and all other solutions. Running that command works perfect to me. I'm currently using IntelliJ 2019.2, but this also happened in previous versions and solution worked as well.

    0 讨论(0)
  • 2020-11-30 18:52

    Missing io? Try import org.openide.util.io.ImageUtilities.

    0 讨论(0)
  • 2020-11-30 18:54

    File -> Invalidate Caches/Restart And Build your project

    0 讨论(0)
  • 2020-11-30 18:54

    Please try File-> Synchronize. Then close and reopen IntelliJ before you invalidate.

    Once I restarted. I would have invalidated but the synchronize cleared everything after restarting.

    0 讨论(0)
提交回复
热议问题