16

Windows 7, Android Studio 2.3

I has 3 emulators. And all success start from Android Studio.

But I want to start them from command line. So my steps (from command lines):

  1. emulator -list-avds

Success show all my emulators:

  1. Nexus_3_7_API_17_ver_4_2_1
  2. Nexus_3_7_hdpi_API_24_7_0
  3. Nexus_5_96_xxhdpi_API_24_7_0

So I want to start one of them:

emulator -avd Nexus_3_7_API_17_ver_4_2_1

But I get error:

[8648]:ERROR:./android/qt/qt_setup.cpp:28:Qt library not found at ..\emulator\lib64\qt\lib
Could not launch '..\emulator/qemu/windows-x86_64/qemu-system-i386.exe': No such file or directory
Pushpendra
  • 2,791
  • 4
  • 26
  • 49
Alexei
  • 14,350
  • 37
  • 121
  • 240

7 Answers7

18

I had the exact same issue and I am using a workaround. Let me explain:

There is a 'bug' in the emulator: it is not able to find the relative path

..\emulator\lib64\qt\lib

Incredibly awesome since this is so simple to fix... whatever.

Just cd to c:\path\to\your\android-sdks\emulator, typically something like

cd c:\Users\<YOUR_USER_NAME>\android-sdks\emulator

then, in this directory, run any emulator command you want, for instance your command:

emulator.exe -avd Nexus_3_7_API_17_ver_4_2_1

in your teminal this will look like this:

c:\Users\<YOUR_USER_NAME>\android-sdks\emulator> emulator.exe -avd Nexus_3_7_API_17_ver_4_2_1

and it will work.

Pascal
  • 15,257
  • 2
  • 52
  • 65
12

Adding emulator path in Environmental Variables solved my problem. Now, I can run emulator command from anywhere.

You can achieve this by following these steps:

  1. Open 'Advanced System Settings'.
  2. Click 'Environmental Variables'.
  3. Add the following to Path variables in both boxes:

    %USERPROFILE%\AppData\Local\Android\Sdk\emulator

  4. Restart Command Prompt.

Note: Your path could be different than the one mentioned above. If this is the case, then you have to search for your emulator path.

Watercayman
  • 7,970
  • 10
  • 31
  • 49
Ummi Shah
  • 131
  • 1
  • 3
1
  1. Open Command Prompt
  2. go to path of your emulator for ex:

$ cd c:\sdk\tools

  1. run emulator :

$ emulator -avd Nexus_3_7_API_17_ver_4_2_1

Mortada Jafar
  • 3,529
  • 1
  • 18
  • 33
  • 1
    Is it possible from any place to run emulator? Without cd c:\sdk\tools – Alexei Apr 26 '17 at 08:00
  • 1
    emulator dependent on libraries in that folder in linux you can use this by add this function to ~/.profile (or ~/.bashrc) : function emulator { cd "$(dirname "$(which emulator)")" && ./emulator "$@"; } – Mortada Jafar Apr 26 '17 at 08:03
  • I was able to make it work by adding the following to my bashhrc: "function emulator { cd '/Users/locus/Library/Android/sdk/emulator' ./emulator "$@" }" – Brndn Jun 22 '23 at 09:14
1

For Mac user, similar to Pascal's answer, in Terminal type:

cd /Users/myname/Library/Android/sdk/tools
./emulator -adv mydevicename

For other mac users below might be what's needed.

cd ~/Library/Android/sdk/emulator
./emulator -avd Nexus_S_API_31 -change-locale fr-CA

my error when executing the followings:

emulator -avd Pixel_2_API_28

[4809612736]:ERROR:android/android-emu/android/qt/qt_setup.cpp:28:Qt library not found at ../emulator/lib64/qt/lib
Could not launch '/Users/myname/.android/../emulator/qemu/darwin-x86_64/qemu-system-x86_64': No such file or directory
Jojo Narte
  • 2,767
  • 2
  • 30
  • 52
Jay Cheung
  • 43
  • 9
0

i think the error due to ,u didn't specified exact location so do like this

  • Open Command Prompt write this emulator -avd avd_name [ {-option [value]} … ]

/Users/janedoe/Library/Android/sdk/tools/emulator -avd Nexus_3_7_API_17_ver_4_2_1 -netdelay none -netspeed full

Abubakar
  • 374
  • 3
  • 16
0

Open command prompt and enter this path:

cd c:\Users\userName\android-sdks\emulator

after this:

emulator -avd avd_name

0

Add the following to your ~/.bashhrc or ~/.zshrc, remembering to update the username:

function emulator {
  cd '/Users/locus/Library/Android/sdk/emulator'
  ./emulator "$@"
}

Afterwards do to reload the changes:

source ~/.zshrc

Then, verify it works by running:

emulator -list-avds
Brndn
  • 676
  • 1
  • 7
  • 21