Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to launch Android Emulator outside of Android Studio on MacOSX

I am getting the following error after I pinned qemu process to the dock then quit and click on it again. Is there a way to launch the emulator directly from the Finder without going first to Android Studio?

   /Users/johnny/Develop/android/sdk/tools/qemu/darwin-x86_64/qemu-system-x86_64 ; exit;
    dyld: Library not loaded: libQt5Widgets.5.dylib
      Referenced from: /Users/johnny/Develop/android/sdk/tools/qemu/darwin-x86_64/qemu-system-x86_64
      Reason: image not found
    [1]    48616 trace trap  /Users/johnny/Develop/android/sdk/tools/qemu/darwin-x86_64/qemu-system-x86_6

    [Process completed]
like image 951
John Difool Avatar asked Apr 17 '16 22:04

John Difool


2 Answers

Seems like some dynamically linked libraries were moved around with the new Android emulator.

All you need to do is: add the folder with the libraries to the search path before you launch the emulator from command line.

Something like:

export DYLD_LIBRARY_PATH="<path to your SDK>/tools/lib64:<path to your SDK>/tools/lib64/qt/lib:$DYLD_LIBRARY_PATH"

Assuming that you want to launch the 64 bit version. Apart from that you can launch the emulator using this command line:

emulator64-x86 -avd <name_of_your_AVD_file>

Just mind that instead of space characters use underscore in the AVD name. And of course use the emulator executable which one you need.

like image 137
racs Avatar answered Oct 06 '22 00:10

racs


There is another reason why this error appears. Recently (around March 2021) the emulator was updated in Google Android which causes this error to appear on at least one or two Mac OS versions. In my case, OSX Mojave: 10.14.6. Examples of the error include: https://stackoverflow.com/a/66422209/340175 and https://stackoverflow.com/a/66744837/340175

In my case I was able to resolve the problem by downgrading the emulator. I downgraded the emulator with the version mentioned in https://stackoverflow.com/a/64301909/340175 Here's the link to it https://dl.google.com/android/repository/emulator-darwin-6885378.zip I've also raised an issue so Google are aware of the issue https://issuetracker.google.com/issues/183295965 you're welcome to 'star' the issue so they'll know how many people it's affecting.

FYI there's a long running discussion in another post on a similar problem with the emulator failing to start. ERROR Android emulator gets killed

like image 36
JulianHarty Avatar answered Oct 06 '22 00:10

JulianHarty