You might want to also set the environment variable JAVA_HOME to point to the java 11 as well. For Mac, add the following line in the ~/.bash_profile file and then restart the command line.
Try to upgrade your gradle version, this line: classpath 'com.android.tools.build:gradle:4.1.0' Upgrading to 4.1.0 helped me, though it was in Flutter.
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.
An exception has occurred in the compiler (1.8.0_242-release). Please file a bug against the Java compiler - Flutter Ask Question Asked 4 years, 5 months ago Modified 4 years, 4 months ago
I reported it java bug reporting page. I updated the jdk and flutter to latest version. Flutter 3.7.3 Dart 2.19.2 DevTools 2.20.1 jdk-19.0.2 android -> app -> build.gradle