Opening Android Emulator from terminal with global accessible shell script.


#!/bin/bash


# Change to the Android SDK directory
cd ~/Library/Android/sdk/emulator


# List the available AVDs
echo "Available AVDs:"
./emulator -list-avds


# Prompt the user to choose an AVD
echo "Enter the name of the AVD you want to launch:"
read avd_name


# Launch the chosen AVD
./emulator -avd "$avd_name"        

  1. Save the file with a descriptive name, such as launch-android-emulator.sh, in a location where you can easily find it later.
  2. Open the terminal and navigate to the directory where you saved the script.
  3. Make the script executable by running the following command: chmod +x launch-android-emulator.sh
  4. To run the script, simply type ./launch-android-emulator.sh in the terminal and press Enter.

The script will prompt you to choose an AVD from a list of available options, and then launch the selected AVD in the Android emulator. You can modify the script to include additional options or customizations as needed.


$ ./launch-android-emulator.s

Available AVDs:

Pixel_XL_API_29

Enter the name of the AVD you want to launch:

Pixel_XL_API_29

emulator: WARNING: Running on a sytem with less than 8 logical cores. Setting number of virtual cores to 1

emulator: INFO: boot completed

emulator: INFO: boot time 136746 ms

emulator: Increasing screen off timeout, logcat buffer size to 2M.

emulator: Revoking microphone permissions for Google App.h        

Global access

But I want to access it globally so need to move it in user/bin.

sudo  mv your-path-to/launch-android-emulator.sh /usr/local/bin/        

Now launch it from anywhere in your terminal:

$ launch-android-emulator.sh        

To view or add a comment, sign in

Insights from the community

Others also viewed

Explore topics