After I installed two versions of JDK (17 and 21) and uninstalled them, I saw this error when trying to launch my Android Studio. This error is hard to fix. Reinstalling Android Studio won’t fix it. And even after I searched google and asked chatGPT and try all the suggestion they give, the problem continued for two days.
The eventual solution is from a StackOverflow article (sorry I forget the url):
# firstly, manually uninstall Android Studio # then rm -rf /Library/Java/JavaVirtualMachines/* # then rm ~/Library/Application\ Support/Google/AndroidStudio* # then rm -rf ~/Library/Caches/ # now install the Android Studio and it could be launched correctly