Summary of solutions to all IntelliJ idea cannot resolve symbol XXX problems

Time:2021-4-8

When using IntelliJ idea to develop, there are often various problems of cannot resolve symbol XXX, cannot resolve symbol string, log and so on. You can click to view the summary of solutions to the problems of IntelliJ idea cannot resolve symbol XXX and solve all the problems of cannot resolve symbol XXX at one time.

Intellij IDEA Cannot Resolve Symbol XXX问题的解决方法

There are basically two reasons for Maven project to encounter this kind of problem: the dependency corresponding to the class is not loaded, the compiler’s own setting and caching problems.

  Solve the first category:

1. Check the POM file of the project to see if the necessary dependencies are clearly written;

2. Whether to use your own private library, < repositories >

  <repository>

  <id>release</id>

  <name>Private  Repository</name>

  <url>http://xxxxxx</url>

  </repository>

  </repositories>

  <pluginRepositories>

  <pluginRepository>

  <id>release</id>

  <name>PrivateRepository</name>

  <url>http://xxxxxxx</url>

  </pluginRepository>

  </pluginRepositories>

POM file has such a way that it uses its own private library. Whether the user name and password of the library are written clearly is generally in the Maven program directory settings.xml File, under the < servers > tag, similar to this:

  <servers>

  <server>

  <id>nexus</id>

  <username>admin</username>

  <password>aaaaaaaaaa</password>

  </server>

  <servers>

3. After the dependency is added correctly, check whether the local class has been downloaded. Generally, check whether there is a corresponding jar package in the path of “C:: (users) ﹣ administrator ﹣ M2 ﹣ repository”. If not, open the “Maven projects” tag in the compiler, clean it first, and then execute install. The effect here is the same as that in the command line.

Intellij IDEA Cannot Resolve Symbol XXX问题的解决方法

If there is such a package, it should be the second kind of problem.

 Solve the second category:

1. File – project structure – Project SDK, check if the SDK is selected, and reselect a local JDK installed by yourself.

2. If Maven is set successfully in the compiler, file – Settings – Search maven, Maven home directory, and set it as the Maven path of your own installation

Intellij IDEA Cannot Resolve Symbol XXX问题的解决方法

3. If the error still cannot be found, try Maven Projects – Report on the right, refresh the style button, and clear the compiler cache

The above is the solution to the problem of IntelliJ idea cannot resolve symbol XXX brought by developer. I hope it can help you. If you have any questions, you can leave us a message in the comment box below. We will try our best to answer for you. Thank you for your support as always, and please continue to pay attention to the follow-up tutorials and software of developer.