Setting Up and Configuring for Mobile App automationSetting up the Android Development Environment Variable for Mac OS

Setting up the Android Development Environment Variable for macOS

Configure the ANDROID_HOME environment variable on macOS to enable Appium-based mobile app automation testing.

Prerequisites

Ensure that Android Studio, Android Software Development Kits (SDKs), and Emulators are successfully installed and configured before proceeding with further setup steps.

Download and install Android Studio from the official website: Android Studio. Install the necessary SDK platforms. Create and configure Android Emulators for testing.

If you encounter any issues while scraping or executing a mobile automation script on macOS, then perform the following to set up the Android environment variable:

  1. To run the nano ~/.bash_profile command on a Mac, perform the following:
    1. Open Terminal: You can find Terminal in the "Utilities" folder within the "Applications" folder, or you can use Spotlight search (Cmd+Space, then type "Terminal").

    2. Run the command:

      In the Terminal window, type nano ~/.bash_profile and press Enter. This command opens the Bash profile file (~/.bash_profile) in the Nano text editor or your preferred text editor. If the file doesn't exist, Nano creates a new one. The ~ represents your home directory.

  2. In the Nano text editor, update your Android SDK path by adding the following line:
    export ANDROID_HOME=/Users/<Username>/Library/Android/sdk
    
    This line sets the environment variable ANDROID_HOME to the specified Android SDK path. In this line, replace <Username> with your actual username.
  3. Save and Exit
    1. Press Ctrl+O to write the changes, then press Enter.
    2. Press Ctrl+X to exit Nano. These commands save the changes and exit the editor.
  4. To verify if the path is configured, run the following command in the Terminal window:
    echo $ANDROID_HOME
    
    This command prints the value of the ANDROID_HOME variable in the terminal.
  5. After saving and exiting, close and reopen the Terminal to ensure that the path is set permanently.
    1. Upon opening a new terminal session, run the echo $ANDROID_HOME command again to check if the variable is still set. If the path is displayed correctly without any reconfiguration, it indicates that the setting is persistent across terminal sessions.
    2. Upon setting the environment variables, you can open the Appium Inspector, specify the desired capabilities (configuration settings for your test), and start a testing session.