当我尝试在 Mac OS X 上运行 Android Emulator 时出现“找不到命令”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10269274/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 03:04:37  来源:igfitidea点击:

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

androidmacosshellemulation

提问by Kebman

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

当我使用Mac OS X 终端导航到带有我的 Android 模拟器的文件夹并键入时emulator,我得到:

command not found

找不到相关命令

Here's what happens:

这是发生的事情:

$ emulator
-bash: emulator: command not found

How do I get it to work?

我如何让它工作?

回答by eggyal

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

当前目录中通常不包含在$PATH* nix的操作系统如OS X; 要在当前目录中执行程序,请在它前面加上当前目录的路径 ( .):

$ ./emulator

回答by Vlad Vinnikov

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

模拟器可以通过 Android Studio 添加https://developer.android.com/studio/run/managing-avds.html

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

启动模拟器: ~/Library/Android/sdk/tools/emulator -avd Nexus_5X_API_23

Related question: How do I launch the Android emulator from the command line?

相关问题:如何从命令行启动 Android 模拟器?

回答by Anney

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.

打开安卓工作室。单击 AVD 管理器(带有 android 和手机的图标)[示例图像:AVD 管理器]。查看模拟器列表。如果您没有安装模拟器,您应该会看到类似“安装模拟器”的内容

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

成功后,您会将工具文件夹下载到您的~/Library/Android/sdk

That is the folder you want, because it has the androidand emulatorcommand line tools.

那就是你想要的文件夹,因为它有androidemulator命令行工具。