Problem
IntelliJ IDEA reports an error "Cannot resolve symbol"
Solutions
-
Solution 1: Change or reapply the JDK
Go to File | Project Structure | Project and select a different JDK in the SDK drop-down (download a new one if needed).
Alternatively, remove the existing JDK, click OK to save the changes, then reopen the dialog and select the JDK from the drop-down again.
-
Solution 2: Invalidate caches and restart
- Go to File | Invalidate Caches
- Check the first three boxes
- Click Invalidate & Restart
- Wait for indexing to finish, ensuring that no tasks are running in the status bar at the bottom
-
Solution 3: Reset project configuration
Try re-generating the project configuration settings:
- Close all open instances of the IDE
- Go to the project directory in your OS file explorer
- Delete the entire
.ideafolder from the project root and any*.imlfiles from the project root and module directories - Launch the IDE, go to File | New | Project from Existing Sources, and select the project’s source (root directory or main build file)
- Wait for indexing to finish so that no tasks are running in the status bar at the bottom
Solution 3A: Re-import Maven or Gradle projects
If your project uses a Maven or Gradle build system:
- Close all instances of IntelliJ IDEA
- Clear the application cache by renaming or removing the entire IDE system directory
- Re-import the project:
- Go to File | Open
- Navigate to the project directory
- Double-click the root
pom.xmlorbuild.gradle(.kts)file - Choose Open as Project
- Wait for indexing to finish so that no tasks are running in the status bar at the bottom
Solution 4: Clear the IDE system directory
- Close all open instances of the IDE
- Clear the application cache by removing the entire IDE system directory IDE system directory.
What to do if nothing helps
- Use this search link to check for similar issues reported in our bug tracker
- If nothing matches your case:
- Submit a new report to YouTrack (see the guide on how to Create and Edit Issues)
- Or contact support via Help | Contact Support from the main menu, and describe the steps you’ve already taken
Comments
0 comments
Please sign in to leave a comment.