To set ANDROID_HOME and JAVA_HOME permanently on Mac OS for Ionic in 2023, you can follow these steps:
Step 1: Install Java 11. Latest version of Ionic require Java 11 instead of Java 1.8.x.
Download and Install Java 11 from this link:
Step 2: Download and install latest version of Android Studio
You need refer latest API version required by Google Play here:
Only if you are using Cordova, you need also make sure Cordova support the target SDK version
Step 3: Edit bash profile. This is for MacOS Monterey. Different version of Mac may have different file.
sudo nano ~/.zshrc
Edit as folllow:
Step 4: Save and quit the terminal. Reopen and verify: