Compose found java8 not working and required Java11 to make the following error.

An exception occurred applying plugin request [id: 'com.android.application']
> Failed to apply plugin 'com.android.internal.application'.
   > 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`.
Copy the code

AGP 7.0: Next Major Release for the Android Gradle Plugin

Older versions of AS can be changed here.

The new version does not. That option is gone

The correct way to change is as follows

View the current JDK directory location

$ /usr/libexec/java_home -v 11
/Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home
Copy the code
$ echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/jdk18.. 0 _191.jdk/Contents/Home
Copy the code