Android Gradle plugin requires Java 11 to run

While running the Android app if you are getting the following error:

Caused by: com.android.builder.errors.EvalIssueException: Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8.
You can try some of the following options:

changing the IDE settings.
changing the JAVA_HOME environment variable.
changing org.gradle.java.home in gradle.properties.

Here is the fix for the same:

In Android Studio, go to Preferences | Build, Execution, Deployment | Build Tools | Gradle

Setting that jdk to /Applications/Android Studio.app/Contents/jre/Contents/Home path will resolve your issue and the app will run in the Android Simulator now.