7

I'm trying to setup an Android Emulator in order to use Cordova. I installed everything I need, the Android SDK Tools (25.2.5), Android SDK Build-tools (25.*) and Android SDK Platform-tools, along with every packet under Android 7.1.1 (API 25). I then go to andoird avd and choose to create an AVD based on one of the templates (google nexus 5) with the default name (AVD_for_Nexus_5_by_Google). However, when i go run it on "Android Virtual Devices", i get the error message:

"Starting emulator for AVD 'AVD_for_Nexus_5_by_Google' PANIC: Unknown AVD name [AVD_for_Nexus_5_by_Google], use -list-avds to see valid list. HOME is defined but could not find AVD_for_Nexus_5_by_Google.ini file in $HOME/.android/avd (Note: avd is searched in the order of $ANDROID_AVD_HOME,$ANDROID_SDK_HOME/.android/avd and $HOME/.android/avd)"

If i just have created it, why doesn't it show up? When i do "emulator -list-avds", nothing shows up. And when i do an "ls /root/.android/avd" on , i can see both files: "AVD_for_Nexus_5_by_Google.avd AVD_for_Nexus_5_by_Google.ini"

Thanks!

Percy
  • 321
  • 1
  • 2
  • 7

1 Answers1

13

The problem was that i hadn't defined the env variables. To fix this put this lines in a text file (modify the directories accordingly):

export ANDROID_HOME=/root/Android/Sdk/ export PATH=${PATH}:/root/Android/Sdk/tools/ export ANDROID_AVD_HOME=/root/.android/avd/

And then do a "source /textfile" in the terminal you're using. If you're not sure which directory's storing your avd, do a "updatedb && locate *.avd"

Percy
  • 321
  • 1
  • 2
  • 7
  • after adding it fixed the original error but I got emulator Missing initial data partition file – Aditya Mittal Feb 20 '18 at 13:04
  • Obviously, you are not on windows. What is `updatedb`? I presume the `locate` command is in my source code directory and should actually be `dir /s/b *.avd` right? – pashute Apr 10 '18 at 10:35
  • Path on Windows: `C:\Users\\AppData\Local\Android\Sdk\tools` , this is notably where the `emulator` binary is located in. – gaborous Feb 04 '23 at 19:05