IntelliJ
debugging
unresolved references
Java IDE
code errors

Everything red in IntelliJ: project JDK misconfigured or symbols not resolved

Codemia Knowledge Hub ·

When IntelliJ IDEA marks every declaration or method in red, the code is usually fine and the project setup is not. The most common causes are a missing or misconfigured SDK, broken module settings, dependencies that have not synced from Maven or Gradle, and corrupted IDE caches. Work through them in that order.

Red underlines normally mean an unresolved declaration, method or import. When they show up everywhere, including on standard classes, they are pointing at configuration rather than at your code.

Causes and fixes

1. Missing or misconfigured SDK

If IntelliJ cannot find or link the SDK, it cannot resolve references, even to JDK classes.

  • Fix: Open File > Project Structure > Project and check that the right SDK is selected. If it is missing, add it under File > Project Structure > Platform Settings > SDKs and then select it.

2. Incorrect module configuration

Modules hold the settings for building, running and testing code. A module that is not configured or linked correctly produces unresolved symbols.

  • Fix: Open File > Project Structure > Modules. Check the source folders, output paths and dependencies, and make sure each module uses the correct language level.

3. Maven or Gradle dependency problems

External libraries are resolved through your build tool, so a broken Maven or Gradle configuration leaves their symbols unresolved.

  • Fix:
    • Maven: In the Maven Projects tool window, choose "Reimport All Maven Projects".
    • Gradle: Click "Refresh all Gradle projects" in the Gradle tool window.
    • Check pom.xml or build.gradle for errors or missing artifacts.
    • If external repositories are unreachable, check your network connection.

4. Corrupted caches

Caches speed the IDE up, but a corrupted cache can report declarations as unresolved.

  • Fix: Choose File > Invalidate Caches / Restart, then invalidate and restart so IntelliJ rebuilds them.

5. Wrong or missing imports

Sometimes the import statements really are wrong or missing.

  • Fix: Check the imports by hand, or use Code > Optimize Imports and make sure every required package is imported.

Example: java.util.List shows red

Here a standard JDK interface appears unresolved:

java
1import java.util.List;
2
3public class Example {
4  List<String> myList; // This line shows red
5}

Since List is part of the JDK, the import is not the problem:

  • Check the SDK: Make sure the project SDK points to a valid JDK.
  • Invalidate caches: If the SDK is correct and the red remains, invalidate caches and restart.
  • Re-import dependencies: With Maven or Gradle, make sure the project is synced.

If none of that works

  • IDE logs: Open them with Help > Show Log in Explorer/Finder for more detail on persistent problems.
  • Plugin conflicts: Some plugins interfere with normal operation. Disable non-essential plugins and see whether the problem goes away.
IssueCauseRecommended Actions
Missing SDK/Invalid Project SetupSDK not configuredSet appropriate SDK in Project Structure.
Incorrect Module ConfigurationModule specifics like sources, output unsetCorrect module settings in Project Structure.
Dependency ErrorsMaven/Gradle config errorsRe-import project dependencies.
Cache CorruptionCached data incorrectInvalidate caches and restart IntelliJ.
Incorrect Import StatementsMissing or wrong importsEnsure necessary imports are included.

Course
Intermediate
27 lessons
14 hours
OOD Fundamentals

Master object-oriented design from first principles, SOLID, design patterns, and classic interview problems with hands-on coding.

View the course
Data Structures & Algorithms practice on Codemia

Step through 300+ coding interview problems with animated visualisers that show the data structure changing as the code runs. The Blind 75 are free.

Practice algorithms