Android 模拟器无法在 vs code 中打开

Android emulator not opening in vs code

当我在 vs code 中使用 `flutter 时,我可以轻松启动 android 模拟器,但是当我在 vs code 中使用 react native 时,我得到这个:

Command 'React Native: Launch Android Emulator' resulted in an error (Error while executing command 'emulator -list-avds': Command failed: emulator -list-avds 'emulator' is not recognized as an internal or external command, operable program or batch file. )

这个错误让我很痛苦,请帮忙。我正在使用 expo CLIreact native

windows中,您可以转到开始>控制面板>系统>高级系统设置>环境变量。 然后在 System Variables 下找到 Path 并双击它并添加此路径 C:\Users\<your-username>\AppData\Local\Android\sdk\emulator 或在 windows 7 中在行尾附加带有 ; 的路径。

然后点击确定按钮退出。

如果您已经打开了 命令提示符 window,请将其关闭,然后 re-open 然后 emulator -list-avds 命令应该会起作用。