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
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
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.
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:
/root/.android/avd
/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.
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.
Copy the Nexus_5X_API_27.ini
from $HOME/.android/avd/
to $ANDROID_SDK_HOME/avd/
will solve the problem.
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.
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!
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With