IntelliJ inspection gives "Cannot resolve symbol" but still compiles code

There are a few possible reasons why IntelliJ might show a "Cannot resolve symbol" error while still being able to compile your code. Here are some things you can try:

  1. Make sure that you have the necessary dependencies in your project. If you are using a library or framework that is not included in your project, IntelliJ will not be able to resolve the symbols for that library.

  2. Check if you have any issues with your project configuration. In IntelliJ, go to "File > Invalidate Caches / Restart" and select "Invalidate and Restart". This will reset your project configuration and might fix the issue.

  3. Make sure that you are using the correct package for the symbol you are trying to use. If you have imported the wrong package, IntelliJ will not be able to find the symbol.

  4. If you are using an external library or dependency, make sure that it is properly configured in your project. You may need to add the library to your classpath or import it in your code.

I hope these suggestions help! Let me know if you have any other questions.