I get the following error when trying to start the Android emulator via the command line:
Could not launch '~/Library/Android/sdk/emulator/qemu/darwin-x86_64/qemu-system-aarch64': No such file or directory
~/Library/Android/sdk/tools/emulator @Pixel_8_API_34
.Starting the emulator via the virtual device manager GUI has no problems.
The error looks to be occurring because the correct location of the emulator binary is:
~/Library/Android/sdk/emulator/qemu/darwin-aarch64/qemu-system-aarch64
Compare with the incorrect location:
~/Library/Android/sdk/emulator/qemu/darwin-x86_64/qemu-system-aarch64
-verbose
Running with -verbose
gives the following information:
emulator:Android emulator version 26.0.3.0 (build_id 3965150)
emulator:Found AVD name 'Pixel_8_API_34'
emulator:Found AVD target architecture: arm64
emulator:argv[0]: '~/Library/Android/sdk/tools/emulator'; program directory: '~/Library/Android/sdk/tools'
emulator:Auto-config: -engine qemu2 (arm64 default)
emulator: Found directory: ~/Library/Android/sdk/system-images/android-34/google_apis_playstore/arm64-v8a/
emulator:try dir ~/Library/Android/sdk/tools
emulator:try dir ~/Library/Android/sdk/tools/
emulator:try dir ~/Library/Android/sdk/emulator
emulator:Found target-specific 64-bit emulator binary: ~/Library/Android/sdk/emulator/qemu/darwin-x86_64/qemu-system-aarch64
emulator:Adding library search path: '~/Library/Android/sdk/emulator/lib64'
emulator:Adding library search path: '~/Library/Android/sdk/emulator/lib64/gles_swiftshader'
emulator:Adding library search path: '~/Library/Android/sdk/emulator/lib64/gles_angle'
emulator:Adding library search path: '~/Library/Android/sdk/emulator/lib64/gles_angle9'
emulator:Adding library search path: '~/Library/Android/sdk/emulator/lib64/gles_angle11'
emulator: Adding library search path for Qt: '~/Library/Android/sdk/emulator/lib64/qt/lib'
emulator: Setting Qt plugin search path: QT_QPA_PLATFORM_PLUGIN_PATH=~/Library/Android/sdk/emulator/lib64/qt/plugins
emulator: Running :~/Library/Android/sdk/emulator/qemu/darwin-x86_64/qemu-system-aarch64
emulator: qemu backend: argv[00] = "~/Library/Android/sdk/emulator/qemu/darwin-x86_64/qemu-system-aarch64"
emulator: qemu backend: argv[01] = "@Pixel_8_API_34"
emulator: qemu backend: argv[02] = "-verbose"
emulator: Concatenated backend parameters:
~/Library/Android/sdk/emulator/qemu/darwin-x86_64/qemu-system-aarch64 @Pixel_8_API_34 -verbose
Could not launch '~/Library/Android/sdk/emulator/qemu/darwin-x86_64/qemu-system-aarch64': No such file or directory
Android Studio:
Virtual device:
I've looked at the documentation for starting the Android emulator on the command line but am not certain if there's an option.
The issue lies in the fact that you're using
~/Library/Android/sdk/tools/emulator
which contains an outdated version of the emulator that no longer receives updates, ever since Google updated the Android SDK structure, and decided to put the emulator in a separate location from other tools.
You should be using this instead:
~/Library/Android/sdk/emulator/emulator