IntelliJ IDEA "cannot resolve symbol" and "cannot resolve method"

Intellij Idea

Intellij Idea Problem Overview


What are common causes for IntelliJ IDEA not being able to resolve built-in JVM types and methods? For example, when I mouse over String the tooltip says "Cannot resolve symbol 'String'". It's as if IntelliJ has doesn't know where the JVM is.

By the way, I am running OS X 10.6.6. Everything was working fine until I ran the system update this morning.

Intellij Idea Solutions


Solution 1 - Intellij Idea

Most likely JDK configuration is not valid, try to remove and add the JDK again as I've described in the related question here.

Solution 2 - Intellij Idea

First check if you have configured JDK correctly:

  • Go to File->Project Structure -> SDKs
  • your JDK home path should be something like this: /Library/Java/JavaVirtualMachine/jdk.1.7.0_79.jdk/Contents/Home
  • Hit Apply and then OK

Secondly check if you have provided in path in Library's section

  • Go to File->Project Structure -> Libraries
  • Hit the + button
  • Add the path to your src folder
  • Hit Apply and then OK

This should fix the problem

Solution 3 - Intellij Idea

For me, IntelliJ could autocomplete packages, but never seemed to admit there were actual classes at any level of the hierarchy. Neither re-choosing the SDK nor re-creating the project seemed to fix it.

What did fix it was to delete the per-user IDEA directory ( in my case ~/.IntelliJIdea2017.1/) which meant losing all my other customizations... But at least it made the issue go away.

Solution 4 - Intellij Idea

I was facing the same problem when import projects into IntelliJ.

for in my case first, check SDK details and check you have configured JDK correctly or not.

Go to File-> Project Structure-> platform Settings-> SDKs

Check your JDK is correct or not.

enter image description here

Next, I Removed project from IntelliJ and delete all IntelliJ and IDE related files and folder from the project folder (.idea, .settings, .classpath, dependency-reduced-pom). Also, delete the target folder and re-import the project.

The above solution worked in my case.

Solution 5 - Intellij Idea

For me, I had to remove the intellij internal sdk and started to use my local sdk. When I started to use the internal, the error was gone.

my sdks

Solution 6 - Intellij Idea

First of all you should try File | Invalidate Caches and if it doesn't help, delete IDEA system directory. Then re-import the Maven project and see if it helps.

Solution 7 - Intellij Idea

For me ,

File -> project structure -> Project Language Level (11) selection worked. Local variable syntax for lambda paramters.

Solution 8 - Intellij Idea

In my case, cloning repo from the remote was the easiest way to solve this issue.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionLandon KuhnView Question on Stackoverflow
Solution 1 - Intellij IdeaCrazyCoderView Answer on Stackoverflow
Solution 2 - Intellij Ideauser4660857View Answer on Stackoverflow
Solution 3 - Intellij IdeaDarienView Answer on Stackoverflow
Solution 4 - Intellij IdeaMaulik KakadiyaView Answer on Stackoverflow
Solution 5 - Intellij IdeaThiago CavalcantiView Answer on Stackoverflow
Solution 6 - Intellij Ideasarjeet singhView Answer on Stackoverflow
Solution 7 - Intellij IdeaRishabh DugarView Answer on Stackoverflow
Solution 8 - Intellij IdeaTemur IsroilovView Answer on Stackoverflow