Zarkron
Zarkron

Reputation: 121

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

Upvotes: 12

Views: 16554

Answers (9)

Ashif Sadique
Ashif Sadique

Reputation: 107

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

Upvotes: 3

Arjun Krishna
Arjun Krishna

Reputation: 71

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.

Upvotes: 2

Deepak Patidar
Deepak Patidar

Reputation: 31

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.

Upvotes: 3

P. Jausions
P. Jausions

Reputation: 129

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.

Upvotes: 1

Yuer_1008
Yuer_1008

Reputation: 291

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!

Upvotes: 1

GitProphet
GitProphet

Reputation: 1038

Deleting C:\Android\android-sdk and reinstalling android studio fixed this for me.

Upvotes: 0

ariya 1990
ariya 1990

Reputation: 1

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

Upvotes: -1

Jefferson Paul Jones
Jefferson Paul Jones

Reputation: 347

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.

Upvotes: 22

lsk
lsk

Reputation: 301

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.

Upvotes: 11

Related Questions