I updated my android studio to 4.1.0 just after that my project (in flutter) has been giving this error constantly.
I downgraded my android studio back to 4.0.1 (the previous version I was using), I still am getting the same error.
I saw some articles on the same error in StackOverflow, it suggested to downgrade but it didn't work, the rest of the suggestions are too complicated for me as I am just a beginner.
I even tried changing Project SDK under Project Structure but even that didn't work.
After installing java jdk (from oracle windowsx64) and changing path name and value as suggested here Setting JAVA_HOME , I am now getting a whole set of another error, which I basically don't understand a bit.