无法在模拟器中启动AVD. sh:grep:找不到命令 [英] Cannot launch AVD in emulator. sh: grep: command not found

查看:104
本文介绍了无法在模拟器中启动AVD. sh:grep:找不到命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Android Studio中,启动AVD Manager,选择一个虚拟设备,然后单击播放"按钮将其启动.

In Android Studio, launch AVD Manager, I choose one of my virtual device and click Play button to start it.

然后我收到此错误消息 "Cannot launch AVD in emulator. sh: file: command not found sh: grep: command not found ... "

Then I get this error message "Cannot launch AVD in emulator. sh: file: command not found sh: grep: command not found ... "

这一直很好,我想我可以通过运行以下命令弄乱PATH变量.

It's fine all the while and I think I mess up with the PATH variable by running the following command.

echo 'export PATH=/Users/xxx/Library/Android/sdk/tools' >> ~/.bash_profile
echo 'export PATH=/Users/xxx/Library/Android/sdk/platform-tools' >> ~/.bash_profile

执行完这些命令后,我也无法在终端中找到像ls这样的简单命令. 然后我通过运行来修复它

After executing these, I couldn't find simple command like ls in Terminal too. Then I fixed it by running

PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin

之后,lsgrep等再次正常运行. 我在终端窗口中检查它,它显示相同的错误之前,运行上面的命令将其修复.

After that, ls, grep etc are working fine again. I check it in the Terminal windows, it is showing the same error before, running the above command fixed it.

但是,当我尝试启动AVD时,它仍然失败,并显示上述错误消息. 尝试重新启动,使cahce无效,无济于事.

However, when I try to launch AVD, it still failed with the error message above. Try to restart, invalidate cahce, nothing help.

推荐答案

您设置的路径错误.实际上,您只是在替换它.您需要做的是添加到路径.像这样:

You are setting your path wrong. In fact you are just replacing it. What you need to do is to add to path. Like this:

echo 'export PATH=$PATH:/Users/xxx/Library/Android/sdk/platform-tools' >> ~/.bash_profile

确保在编辑器中查看〜/.bash_profile并删除以前的PATH条目.

Be sure to view ~/.bash_profile in editor and remove previous PATH entries.

请注意添加的$ PATH.这样,它将采用先前的路径并追加新的路径.

Note the added $PATH. This way it takes the previous path and appends the new one.

PATH=$PATH:your_path_here

这篇关于无法在模拟器中启动AVD. sh:grep:找不到命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆