Intellij Cannot resolve symbol on import

Asaf Ebgi picture Asaf Ebgi · Nov 16, 2014 · Viewed 222.1k times · Source

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:

enter image description here

enter image description here

Anyone have a clue?

Answer

sahitya picture sahitya · Dec 16, 2014

you can try invalidating the cache and restarting intellij, in many cases it will help.

File -> Invalidate Caches/Restart