I followed the steps in the Flutter document and tried to build my first Flutter app in Intellij IDEA. And when I try to run it,there was an error about my JAVA_HOME variabl
I have same problem. I get this error because I edit android module without open it first using AS in another tab (Tools -> Flutter -> Open Android module..). Then I have a solution, just restart and kill the chache in your Android Studio (File -> Invalidate Chache / Restart).
It fixed for me, I hope you too
https://github.com/flutter/flutter/issues/29608#issuecomment-528243662