IntelliJ IDEA “cannot resolve symbol” and “cannot resolve method”

后端 未结 4 938
灰色年华
灰色年华 2020-12-08 12:50

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 \"Cann

相关标签:
4条回答
  • 2020-12-08 13:17

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

    0 讨论(0)
  • 2020-12-08 13:29

    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.

    0 讨论(0)
  • 2020-12-08 13:35

    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.

    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.

    0 讨论(0)
  • 2020-12-08 13:36

    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

    0 讨论(0)
提交回复
热议问题