Cannot resolve symbol


I've run into a bizarre problem where IDEA tells me that it cannot resolve symbol for classes within the same package as the class open in the editor. And, if I use Alt-Enter to add an import line, the import line shows up as greyed-out for 'unused import statement' (but the 'cannot resolve symbol' flag goes away). Similarly, there are a number of classes being flagged with cannot resolve symbol while there's a greyed-out import line that contains a wild-card import that includes those flagged classes.

This is in IDEA 9.0.4 and only just started happening.
Invalidating the caches did not fix the problem
Deleteing the cache files in the filesystem did not fix the problem
Deleting the module and rebuilding it did not fix the problem

Any other ideas?

Comment actions Permalink


Is it possible to reproduce the issue with new sample project? Do you face the same problem with non-Kotlin projects?

Comment actions Permalink

I solved the issue as outlined in this StackOverflow.

Comment actions Permalink

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

File -> Invalidate Caches/Restart

Comment actions Permalink

I had a similar issue. I had a file that suddenly refused to be recognized when attempting to import it. here is what fixed this for me:

1) right clicked
2) chose "refactor">"rename file..." (not "rename...")
3) renamed the file to
4) now all the files recognized the import (because the class in the file was still set to public and still named the same)
5) I then had to refactor>rename the class (I set it to "APIAPI" as well)
6) and then all was well, but I didn't want my file named APIAPI. So I right clicked the file and refactor>rename... it back to
7) and everything was still working.

You might be able to refactor>rename the file and class at the same time, it's just not the path I happened to take, and I'd rather not reproduce the issue.

Comment actions Permalink

File > Inavlidate Caches / Restart worked for me when I had a similar issue. I run into this pretty frequently, unfortunately.


Please sign in to leave a comment.