IntelliJ idea class is normal, but error is marked in red and cannot be found

1. After the import file is opened, it can be modified and the cache update can be triggered.

If there are many files, it is recommended to use 2
2. The first one in the upper left toolbar: File – & gt; Invalidate Caches… -> Invalidate and Restart

Read More: