Output. In the above program, "Cannot find symbol" error will occur because “sum” is not declared. In order to solve the error, we need to define “int sum = n1+n2” before using the variable sum.
First of all you should try File | Invalidate Caches and if it doesn't help, delete IDEA system directory. Then re-import the Maven project and see if it helps.
The reason IntelliJ couldn't find declarations was that the subprojects were not built. After investigating why subprojects were not built, I found out that using "auto-import" was breaking the subprojects. After importing the project from build. gradle without auto-import, it worked for me.
Select Build->Rebuild Project will solve it
I had the same problem and fixed it by clicking File>Invalidate caches/ restart
I had the same problem, and turns out I had never completely compiled the fresh project. So right-clicking and selecting Compile'' (shift-cmd-F9 on mac) fixed it. It seems the compile on save does not 'see' non-compiled files.
Marking the src folder as source did not help in my case.
This is likely to be your ../src folder is not marked as a "source" folder in Intellij IDEA, so it doesn't know to look there to find your class. You can right click the folder in the project explorer and choose "mark as source folder" to fix this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With