javaintellij-ideaimportclasspath

Intellij Cannot resolve symbol on import


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't be resolved.

If on the import statement, I right-click -> Goto -> the package's declaration, I see all the decompiled classes displayed in the side pane -- Including the ones I need -- If I try to auto-complete the import statement, I notice the class I need is not featured in the dropdown.

I tried invalidating caches already, doesn't work. I cannot find any class conflicts -- there is no other jar file in my classpath with the same package name. I am able to import this class into other projects.

Please see screen shots:

Anyone have a clue?


Solution

  • I tried every answer here , What fixed my issue was deleting .idea folder , I did invalidate caches and restart before that and a simple restart after deleting .idea , The IDE asked to reimport gradle project , after the import everything started working normally.