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?

31 Answers

You can try invalidating the cache and restarting IntelliJ, in many cases it will help.

File -> Invalidate Caches/Restart

Leave a Comment