运行模拟器提示Unknown AVD name,刚创建的AVD无法识别求解决
Hey there! I’ve dealt with this exact frustrating issue before when setting up AVDs in Android Studio. Let’s break down why this happens and get your emulator running.
Why This Happens
The error Emulator: ERROR: Unknown AVD name [Nexus_5X_API_27] usually means one of these things:
- The AVD wasn’t actually created successfully (even though Studio said it was)
- The
emulatorcommand can’t find the AVD’s configuration files - There’s a tiny spelling/case mismatch between the name you’re using and the actual AVD name
- Permissions are blocking access to the AVD storage directory
Step-by-Step Fixes
1. Verify the AVD Actually Exists
First, confirm if the AVD is really registered on your system:
- Open a terminal/command prompt
- Run this command:
emulator -list-avds
If Nexus_5X_API_27 doesn’t show up in the output, the AVD wasn’t properly created. Skip to fix #2. If it does show up, move to fix #3.
2. Recreate the AVD (Most Common Fix)
Android Studio’s AVD Manager sometimes glitches and shows a "created" status even when the underlying files are missing:
- Open Android Studio → Tools → AVD Manager
- Find your
Nexus_5X_API_27entry, click the Delete button (trash icon) to remove it completely - Recreate the AVD:
- Make sure the system image you select is fully downloaded (avoid any entries marked "Download")
- Wait for the "AVD created successfully" confirmation before closing the manager
- Run
emulator -list-avdsagain to confirm the name appears
3. Use Exact Name & Path to Launch
If the AVD shows up in the list but still errors out:
- Copy the exact name from the
emulator -list-avdsoutput (even minor case/spelling differences matter!) - Launch the emulator with the copied name:
emulator -avd Nexus_5X_API_27 - If that still fails, specify the SDK system image path directly:
Replaceemulator -avd Nexus_5X_API_27 -sysdir <your-sdk-path>/system-images/android-27/google_apis/x86/<your-sdk-path>with your actual Android SDK root directory (e.g.,~/Android/Sdkon macOS/Linux,C:\Users\YourName\AppData\Local\Android\Sdkon Windows)
4. Fix Permissions (Linux/macOS Only)
On Unix-based systems, permission issues can block the emulator from reading AVD files:
- Run this command in terminal to set proper ownership of the Android directory:
sudo chown -R $USER:$USER ~/.android/ - Try launching the emulator again after running this
5. Check Environment Variables
Ensure the emulator command can locate your SDK:
- Verify that
ANDROID_HOMEorANDROID_SDK_ROOTenvironment variables are set to your SDK root directory - On Windows, add
<your-sdk-path>/emulatorto your System PATH to make theemulatorcommand accessible anywhere
内容的提问来源于stack exchange,提问作者Zarkron

