Android Studio终端启动模拟器求助:emulator命令未识别
Fixing "emulator not recognized" and GPU Error for OREO Emulator
Hey there! Let's tackle your problem step by step—first getting the emulator command recognized by your system, then resolving the original GPU error that started this.
1. Fixing "emulator未被识别为命令" (emulator command not found)
This error pops up because your system doesn't know where the Android emulator executable is stored. Here's how to fix it on different operating systems:
For Windows
- First, find your Android SDK path: Open Android Studio, go to File > Settings > Appearance & Behavior > System Settings > Android SDK—the SDK location is listed at the top of this page.
- The emulator lives in the
emulatorfolder inside your SDK directory. For example, if your SDK path isC:\Users\YourName\AppData\Local\Android\Sdk, the full emulator path isC:\Users\YourName\AppData\Local\Android\Sdk\emulator. - Option 1: Run the command with absolute path (quick fix)
Open Command Prompt and paste the full path to the emulator executable along with your command:C:\Users\YourName\AppData\Local\Android\Sdk\emulator\emulator.exe -avd OREO_Emulator -gpu host - Option 2: Add emulator to system PATH (permanent fix)
- Right-click This PC > Properties > Advanced system settings > Environment Variables.
- Under System variables, locate
Path, then click Edit. - Click New and paste the full path to the
emulatorfolder (like the example above). - Click OK to save all changes, then restart your Command Prompt for the changes to take effect.
For macOS/Linux
- Find your SDK path: In Android Studio, go to Android Studio > Preferences > Appearance & Behavior > System Settings > Android SDK (macOS) or File > Settings > ... > Android SDK (Linux).
- By default, the emulator is in
~/Library/Android/sdk/emulator(macOS) or~/Android/Sdk/emulator(Linux). - Option 1: Run with absolute path (quick fix)
Open Terminal and run:~/Library/Android/sdk/emulator/emulator -avd OREO_Emulator -gpu host - Option 2: Add to PATH permanently
- Open your shell config file (e.g.,
.bashrcfor Bash,.zshrcfor Zsh) using a text editor. For Zsh, run:nano ~/.zshrc - Add this line at the end (replace the path if your SDK is in a different location):
export PATH="$PATH:$HOME/Library/Android/sdk/emulator" - Save and exit the editor, then run
source ~/.zshrc(or your config file) to apply changes right away.
- Open your shell config file (e.g.,
2. Resolving the GPU Error (No Terminal Needed)
If you'd rather avoid terminal commands, you can adjust the emulator's GPU settings directly in Android Studio:
- Open the AVD Manager (the toolbar icon that looks like a phone with a download arrow).
- Find your
OREO_Emulator, click the Edit (pencil) icon next to it. - Scroll down and click Show Advanced Settings.
- Under the Graphics section, change the option to Host (this is exactly what your terminal command was trying to set).
- Click Finish, then start the emulator again.
This should get rid of the GPU error without needing to use the terminal.
内容的提问来源于stack exchange,提问作者Embedded_Dude
相关产品推荐
相关产品推荐

