Process finished with exit code 1 : Unknown AVD na

2019-06-26 05:23发布

问题:

I have the following error that pops up when I try to run the emulator:

Emulator: emulator: ERROR: Unknown AVD name [Nexus_5X_API_27], use -list-avds to see valid list.

Emulator: Process finished with exit code 1

Given that I just created the avd, can you help me understand why it cannot find it and how to solve this problem?

Thanks in advance

回答1:

Why this happened?

When you try to start the avd, android studio will find the Nexus_5X_API_27.ini in $ANDROID_SDK_HOME/avd/. But when you create the avd by android studio, the Nexus_5X_API_27.ini is been put into $HOME/.android/avd/. So android studio can not find the ini file to start the avd.

Resolution

Copy the Nexus_5X_API_27.ini from $HOME/.android/avd/ to $ANDROID_SDK_HOME/avd/ will solve the problem.



回答2:

I experienced the same issue, regardless of the AVD. I'm too new to understand why, but it seems that Android Studio created /.android/avd directories in two locations:

  1. /root/.android/avd
  2. /home/USERNAME/.android/avd

The .avd and .ini created when creating a new AVD were stored in the 1st location, and the 2nd location was empty. To resolve it, I copied and pasted both the .avd and .ini files for each AVD from 1 to 2 (they needed to be in both in order for AS to see and run the AVD). The emulator then ran successfully.



回答3:

If your Android Studio create AVDs in the ~/.android/avd directory, here are the step by step instructions:

  • Open control panel
  • Then go to System
  • Then go to Change Environment Variables of the User
  • Then click create a new environment variables
  • Create a new variable named ANDROID_SDK_HOME
  • Set its value to your Android directory, like C:/users//.android