Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Process finished with exit code 1 : Unknown AVD name

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

like image 680
Zarkron Avatar asked Feb 26 '18 20:02

Zarkron


7 Answers

I was having the same issue. but I did the below

I copied the folder C:\Users\USER_NAME\.android\avd and pasted inside the folder where the Sdk file located i.e C:\Users\USER_NAME\AppData\Local\Android\Sdk and finaly it worked fine for me

like image 146
Ashif Sadique Avatar answered Oct 16 '22 10:10

Ashif Sadique


When you create the AVD with Android Studio it's created in root location but our Android SDk location is set on somewhere in HOME. So you just need to move your avd folder from root location to home location path.

Root location path:

/root/.android/avd

Home location path:

/home/USERNAME/.android/avd

You don't need to keep avd folder on both the location because whenever you run your app on avd from Android Studio it's always looking it on HOME location.

like image 28
Deepak Patidar Avatar answered Oct 16 '22 08:10

Deepak Patidar


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.

like image 26
Jefferson Paul Jones Avatar answered Oct 16 '22 08:10

Jefferson Paul Jones


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.

like image 11
lsk Avatar answered Oct 16 '22 10:10

lsk


I had the same issue working with Android Studio in Win64. I have tried all the above suggested solutions, but none of them worked i.e., even after config changes the emulator was in error state throwing the same error.

However, after reverting back all the config changes and restarting the Android Studio fixed the error. The emulators are up and running. To be honest, there is no custom environment variables defined.

Only exception in my case is, the .ini files are getting created/stored in the $USER_HOME/.android/avd/ directory.

Adding my answer as it may help someone who is facing the similar issue.

like image 2
Arjun Krishna Avatar answered Oct 16 '22 09:10

Arjun Krishna


For windows users, see the ANDROID_SDK_HOME path,then check the ANDROID_SDK_HOME/avd/,is there that Emulator(you just created) existed?If there's not existed,then copy the emulator.avd and emulator.ini files in ANDROID_SDK_HOME/.android/avd/ to ANDROID_SDK_HOME/avd/, finally it did worked!

like image 1
Yuer_1008 Avatar answered Oct 16 '22 09:10

Yuer_1008


There are actually several environment variables that you can set:

  • ANDROID_SDK_HOME
  • ANDROID_EMULATOR_HOME (default is $ANDROID_SDK_HOME/.android/)
  • ANDROID_AVD_HOME (default is $ANDROID_EMULATOR_HOME/avd/)

See https://developer.android.com/studio/command-line/variables

The default location of the Android SDK is your home directory, which depends on your operating system. For instance, on Windows it's C:\Users\*Owner*\AppData\Local\Android\Sdk.

If you have moved your home directory to a different disc, you can use the environment variables mentioned above to adjust the paths on a as-needed basis.

like image 1
P. Jausions Avatar answered Oct 16 '22 10:10

P. Jausions