IntelliJ IDEA Cannot Resolve Symbol

Share
Workaround available Windows, macOS, Linux Updated November 13, 2026Based on 4 user reportsHow we research

Quick answer

Red 'Cannot resolve symbol' errors usually mean the project model or caches are out of sync, not that your code is wrong. Reload the build tool project, check the SDK and invalidate caches.

Most likely fix: Reload the build project

How to fix it

Try these in order — the most common fix is first.

  1. 1. Reload the build project

    1. Maven: click the Sync Maven Changes icon or use Reimport All Maven Projects in the Maven tool window
    2. Gradle: click Reload All Gradle Projects in the Gradle tool window
    Did this fix it?
  2. 2. Check the project SDK

    1. Open File | Project Structure | Project Settings | Project
    2. Select a JDK or use Add JDK from disk
    3. Click Apply
    Did this fix it?
  3. 3. Mark the right source roots

    1. In the Project tool window right-click the folder
    2. Choose Mark Directory as | Sources Root (or Test Sources Root)
    Did this fix it?
  4. 4. Enable annotation processing

    1. Open Settings | Build, Execution, Deployment | Compiler | Annotation Processors
    2. Enable annotation processing and install the Lombok plugin if you use Lombok
    3. Re-import the project
    Did this fix it?
  5. 5. Invalidate caches

    1. Open File | Invalidate Caches and choose Invalidate and Restart
    Did this fix it?

Symptoms

Classes, methods or imports are underlined red although the project builds from the command line.

Why it happens

  • Maven or Gradle project not reloaded after changing pom.xml/build.gradle
  • Dependencies failed to download
  • Wrong or missing project SDK
  • Source folder not marked as a source root
  • Stale caches or indexes
  • Annotation processors (Lombok, MapStruct) not enabled

This guide also covers

  • intellij cannot resolve symbol
  • intellij red code but compiles
  • cannot resolve symbol intellij maven
  • intellij cannot resolve method

Still not working?

If JetBrains IntelliJ keeps failing, you're not alone. See every JetBrains IntelliJ problem users report or the alternatives people switch to.

Have an app idea? Our small team builds any software: web and mobile apps, games, desktop, AI tools. Price agreed together.

Talk to us
Fixed it? Share this guide

Other JetBrains IntelliJ errors

All 12 JetBrains IntelliJ errors and fixes →