I got this error when I updated one of the dependencies in Android Studio that requires Java 11. You just need to follow these steps.
Download the Java 11. For Mac, download a .dmg file and for Windows a ZIP file. Link: Download Java 11
Select options at Android studio
Follow the steps and choose your newly saved Java SDK
Follow the steps and choose your newly saved Java SDK.
(Follow the steps and choose your newly saved JAVAJava SDK.)


