Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can not start android emulator from command line

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
like image 451
Alexei Avatar asked Apr 26 '17 07:04

Alexei


3 Answers

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.

like image 25
Ummi Shah Avatar answered Sep 30 '22 11:09

Ummi Shah


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
like image 28
Jay Cheung Avatar answered Sep 30 '22 09:09

Jay Cheung


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\userName\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\userName\android-sdks\emulator> emulator.exe -avd Nexus_3_7_API_17_ver_4_2_1

and it will work.

like image 181
Pascal Avatar answered Sep 30 '22 09:09

Pascal