I tried to open Android Device Monitor and the Studio showed me this message =-O :

It surprised me, because how have I been able to develop Android apps if I didn't have any Java installed?! Actually, Android Studio comes with bundled JDK/JRE (located in /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home), but it is not found by the system: executed usr/libexec/java_home gives
Unable to find any JVMs matching version "(null)".
No Java runtime present, try --request to install.
Setting $JAVA_HOME to /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home did not help — source .bash_profile doesn't like that it's a directory.
QUESTION: I don't want to install new JDK if I already have one inside Android Studio. How do I set it as system default?
Solution:
export JAVA_HOME=/Applications/Android\ Studio.app/Contents/jre/jdk/Contents/Home/ to .bash_profile file in your home directory. Run source ~/.bash_profile to update terminal.export JAVA_HOME=/Applications/Android\ Studio.app/Contents/jre/Contents/Home to .zshenv file in your home directory. Run source ~/.zshenv to update terminal.After that, running java -version gave this output and Java started to execute normally:
openjdk version "1.8.0_112-release"
OpenJDK Runtime Environment (build 1.8.0_112-release-b06)
OpenJDK 64-Bit Server VM (build 25.112-b06, mixed mode)
As for the Android Device Monitor — it still demands this ancient JRE version 6.
I just did a fresh install of Android Studio Arctic Fox 2020.3.1 on Big Sur, and I had to use the following.
export JAVA_HOME=/Applications/Android\ Studio.app/Contents/jre/Contents/Home/
On a slightly different topic, even with the correct JAVA_HOME, ~/Library/Android/sdk/tools/bin/sdkmanager wouldn't start. I had to install "Android SDK Command-line Tools (latest)" (from Android Studio) and use ~/Library/Android/sdk/cmdline-tools/latest/bin/sdkmanager instead.
The core problem is that starting from Android Studio Arctic Fox the destination of bundled java has been changed from:
/Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/
to:
/Applications/Android Studio.app/Contents/jre/Contents/Home/
You just need to change JAVA_HOME env variable in .bash_profile to the new correct path (be careful with space character, easiest way just to specify path in doubled quotes). And either restart terminal or run source ~/.bash_profile.