Reading Time: < 1 minute

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:

https://www.oracle.com/java/technologies/downloads/#java11:~:text=Java%20SE%20Development%20Kit%2011.0.18

Step 2: Download and install latest version of Android Studio

https://developer.android.com/studio

You need refer latest API version required by Google Play here:

https://developer.android.com/google/play/requirements/target-sdk

Only if you are using Cordova, you need also make sure Cordova support the target SDK version

https://cordova.apache.org/docs/en/11.x/guide/platforms/android/

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:

java -version

Leave a Reply

Your email address will not be published. Required fields are marked *