I get 'Command Not Found' when I try to run Android Emulator on Mac OS X

AndroidMacosShellEmulation

Android Problem Overview


When I use the Mac OS X Terminal to navigate to the folder with my Android Emulator and type emulator, I get:

> command not found

Here's what happens:

$ emulator
-bash: emulator: command not found

How do I get it to work?

Android Solutions


Solution 1 - Android

The current directory is not normally included in your $PATH on a *nix operating system like OS X; to execute a program in the current directory, precede it with the path to the current directory (.):

$ ./emulator

Solution 2 - Android

Emulator can be added with Android Studio https://developer.android.com/studio/run/managing-avds.html

To start emulator: ~/Library/Android/sdk/tools/emulator -avd Nexus_5X_API_23

Related question: https://stackoverflow.com/questions/4974568/how-do-i-launch-the-android-emulator-from-the-command-line

Solution 3 - Android

solutions

> steps

  1. create one symbolic link emulator
# soft link
$ ln -s ~/Library/Android/sdk/tools/emulator /usr/local/bin/emulator

  1. call the command

# check all avd
$ emulator -list-avds

$ emulator @avd_name
# OR
$ emulator -avd avd_name


enter image description here

2. system environment

  1. edit env with vim/vscode
# zsh
$ vim  ~/.zshrc
# OR
$ code  ~/.zshrc


  1. add below lines to the .zshrc file
# export ANDROID_SDK_ROOT=/Users/xgqfrms/Library/Android/sdk

export ANDROID_SDK_ROOT=~/Library/Android/sdk
export ANDROID_HOME=~/Library/Android/sdk
export ANDROID_AVD_HOME=~/.android/avd


  1. update config
# flush update
$ source ~/.zshrc

refs

https://developer.android.com/studio/run/emulator-commandline

Solution 4 - Android

These 3 command works for me on VS Code Terminal (Mac Book Pro M1)

  1. echo 'export PATH=$PATH:~/Library/Android/sdk/emulator/' >> ~/.bash_profile
  2. source ~/.bash_profile
  3. emulator -list-avds

Solution 5 - Android

Open Android Studio. Click on AVD Manager (the icon with the android and phone) [example image: AVD Manager]. See the list of emulators. You should see something like "Install Emulator" if you don't have any.

Once this is successful, you'll get the tools folder downloaded to your ~/Library/Android/sdk

That is the folder you want, because it has the android and emulator command line tools.

Solution 6 - Android

typcally i use from terminal :

./Library/Android/sdk/emulator/emulator *some action*

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionKebmanView Question on Stackoverflow
Solution 1 - AndroideggyalView Answer on Stackoverflow
Solution 2 - AndroidVlad VinnikovView Answer on Stackoverflow
Solution 3 - AndroidxgqfrmsView Answer on Stackoverflow
Solution 4 - AndroidWasitShafiView Answer on Stackoverflow
Solution 5 - AndroidAnneyView Answer on Stackoverflow
Solution 6 - Androidrahman MuhamamdView Answer on Stackoverflow