IntelliJ cannot resolve any symbols or methods

Viewed 12522

IntelliJ IDEA 2017.2

I know this has been asked, but I have tried every fix I could find, as shown below.

Every symbol in my java code has an error Cannot resolve method, or Cannot resolve symbol. However, the code still compiles and runs with 0 errors. The error messages in the IDE started the first time I opened the project, on 3 separate computers, but runs fine on a fourth....I can't find anything different on that fourth computer.

I have following the following instructions from this issue:

File -> Invalidate Caches / Restart

I deleted the [IDEA system](https://intellij-support.jetbrains.com/hc/en-us/articles/206544519-Directories-used-by-the-IDE-to-store-settings-caches-plugins-and-logs) directories, and re-imported the Maven project.

I have re-imported the Maven project

I re-imported the project with auto-import

I also followed the instructions from this issue:

File -> Synchronize

then

File -> Invalidate Caches / Restart

As well as the solutions here:

Check source roots

Ctrl+Alt+Shift+S

There were no errors or fixes in the Module source roots, or the module dependencies.

I also tried re-importing with "Search for projects recursively" checked as recommended here.


Edit1

This isn't a screenshot from my actual code, but my errors look the same as the screenshots from this post.

enter image description here

EDIT2

I just found an error I hadn't seen before. When I go to Project Structure (Ctrl+Alt+Shift+S), under Libraries, I see the following errors.

enter image description here

I checked on the location shown /home/user/.m2/repository/antlr/antlr/2.7.7/antlr-2.7.7-sources.jar and it doesn't exist. I have antlr-2.7.7.jar, but I'm not sure if I need to download the antlr-2.7.7.7-sources.jar, or just point my Library to the .jar I have (as I'm unfamiliar what these settings do)

5 Answers

This is a weird one. I faced the same issue and went through all questions on stackoverflow and other forums and applied all suggestion to an extent to reinstalling intelliJ.

Though what problem in my case was that i had excluded some files namely .gradle and build folder, which definitely sounds important. I must have done this get excluded for git status notifs but somehow i had excluded it from my project as i am new to intellij. To check if any of your folders are exclude goto -> modules CTRL + Shift +Alt + s and check for any red items you should probably include the ones necessary here.

Hope this helps few of those out there.

Related