Cannot resolve any import

Answered

When starting with a skeleton Java project in IDEA 2016.1, on every import (such as java.util.List) the editor complaines that the class cannot be resolved. However the command completion and go-to-declaration will find it. Also the code compiles fine. It seems to be an issue concerning the editor only, but it makes it basically unusable.

I tried the obvious stuff:

  • Check that any/correct JDK is selected for project
  • Invalidate cache
  • Re-install IDE and JDK

But without luck.

The problem seems to be similar to the one reported here: https://intellij-support.jetbrains.com/hc/en-us/community/posts/206838595-Cannot-resolve-symbol-on-import but in my case the problem is with any import.

This is the first time I am using IDEA for Java (only Python so far), so any hint is much appreciated.

 

3 comments

Try to remove IDE folders to start with all the defaults (https://intellij-support.jetbrains.com/hc/articles/206544519). Configure JDK, make a new project and see if it helps.

0

Thanks for the quick answer, but unfortunately still no luck.

I am just creating a plain Java object from scratch from within Intellij, and it would still not recognize the standard library.

However when uninstalling and going back to version 15.0.5, it works. So I guess I will just use the old version and check if the problem is fixed in the next 2016 release.

0

You can try 2016.1.2 EAP: https://confluence.jetbrains.com/display/IDEADEV/IDEA+2016.1+EAP .

However, it's not something that can be easily reproduced, otherwise we'd be flooded with similar reports.

0

Please sign in to leave a comment.