无法在 MacOSX 上的 Android Studio 之外启动 Android Emulator

问题描述:

将 qemu 进程固定到 Dock 后,我收到以下错误,然后退出并再次单击它.有没有办法直接从 Finder 启动模拟器,而无需先进入 Android Studio?

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]

似乎一些动态链接库随着新的 Android 模拟器而移动.

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.

类似于:

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

假设您要启动 64 位版本.除此之外,您可以使用以下命令行启动模拟器:

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>

请注意,在 AVD 名称中使用下划线代替空格字符.当然,使用您需要的模拟器可执行文件.

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