I am encountering an issue when trying to launch the Android emulator from a dock icon on macOS.
Steps to Reproduce:
- I launch the Android emulator successfully from the Virtual Device Manager in Android Studio.
- I pin the emulator’s icon to the dock while it is running.
- I quit the emulator.
- The pinned icon in the dock changes to a generic “cmd” icon with “exec” written on it.
Problem:
When I try to launch the emulator by clicking the “exec” icon in the dock, it starts but then immediately crashes with the following error:
/Users/usamasarwar/Library/Android/sdk/emulator/qemu/darwin-aarch64/qemu-system-aarch64 ; exit;
usamasarwar@Usama-Sarwar ~ % /Users/usamasarwar/Library/Android/sdk/emulator/qemu/darwin-aarch64/qemu-system-aarch64 ; exit;
dyld[8165]: Library not loaded: @rpath/libandroid-emu-tracing.dylib
Referenced from: <4C4C4435-5555-3144-A1F0-A1498EB7DBFF> /Users/usamasarwar/Library/Android/sdk/emulator/qemu/darwin-aarch64/qemu-system-aarch64
Reason: tried: '/Users/usamasarwar/Library/Android/sdk/lib64/qt/lib/libandroid-emu-tracing.dylib' (no such file), '/Users/usamasarwar/Library/Android/sdk/emulator/qemu/darwin-aarch64/libandroid-emu-tracing.dylib' (no such file), '/Users/usamasarwar/Library/Android/sdk/emulator/qemu/darwin-aarch64/lib64/libandroid-emu-tracing.dylib' (no such file), '/Users/usamasarwar/Library/Android/sdk/lib64/qt/lib/libandroid-emu-tracing.dylib' (no such file), '/Users/usamasarwar/Library/Android/sdk/emulator/qemu/darwin-aarch64/libandroid-emu-tracing.dylib' (no such file), '/Users/usamasarwar/Library/Android/sdk/emulator/qemu/darwin-aarch64/lib64/libandroid-emu-tracing.dylib' (no such file), '/usr/lib/libandroid-emu-tracing.dylib' (no such file, not in dyld cache)
zsh: abort
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.
[Process completed]
What I’ve Tried:
- I can still launch the emulator from the Virtual Device Manager in Android Studio without any issues.
- Reinstalled the Android emulator and SDK tools.
- Ensured that ANDROID_HOME and ANDROID_SDK_ROOT environment variables are correctly set.
Environment:
flutter doctor -v
usamasarwar@Usama-Sarwar ~ % flutter doctor -v
[✓] Flutter (Channel stable, 3.22.2, on macOS 14.5 23F79 darwin-arm64, locale
en-PK)
• Flutter version 3.22.2 on channel stable at /Library/Developer/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 761747bfc5 (4 weeks ago), 2024-06-05 22:15:13 +0200
• Engine revision edd8546116
• Dart version 3.4.3
• DevTools version 2.34.3
[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
• Android SDK at /Users/usamasarwar/Library/Android/sdk
• Platform android-35, build-tools 35.0.0
• ANDROID_HOME = /Users/usamasarwar/Library/Android/sdk
• ANDROID_SDK_ROOT = /Users/usamasarwar/Library/Android/sdk
• Java binary at: /Applications/Android
Studio.app/Contents/jbr/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build
17.0.10+0-17.0.10b1087.21-11609105)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 15.4)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 15F31d
• CocoaPods version 1.15.2
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2024.1)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
???? https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
???? https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build
17.0.10+0-17.0.10b1087.21-11609105)
[✓] VS Code (version 1.90.2)
• VS Code at /Users/usamasarwar/Downloads/Visual Studio Code.app/Contents
• Flutter extension version 3.90.0
[✓] Connected device (3 available)
• macOS (desktop) • macos • darwin-arm64 •
macOS 14.5 23F79 darwin-arm64
• Mac Designed for iPad (desktop) • mac-designed-for-ipad • darwin •
macOS 14.5 23F79 darwin-arm64
• Chrome (web) • chrome • web-javascript •
Google Chrome 126.0.6478.127
[✓] Network resources
• All expected network resources are available.
• No issues found!
Question:
How can I correctly configure the emulator to launch from the dock icon without encountering the libandroid-emu-tracing.dylib error?
Any help or guidance on resolving this issue would be greatly appreciated!