You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Apple Silicon Mac下命令行启动Android模拟器报错,求解决方案

Apple Silicon Mac 命令行启动Android模拟器报错:No such file or directory

在搭载Apple Silicon的Mac设备上,通过命令行启动已配置完成的Android模拟器(例如Android 14 API 34版本的Pixel 8)时,出现如下错误:

Could not launch '~/Library/Android/sdk/emulator/qemu/darwin-x86_64/qemu-system-aarch64': No such file or directory

但通过Android Studio虚拟设备管理器GUI启动模拟器则无异常。

复现步骤

  • 使用搭载Apple Silicon的Mac设备
  • 已配置好ARM架构的Android模拟器(例:Pixel 8 API 34)
  • 执行命令:~/Library/Android/sdk/tools/emulator @Pixel_8_API_34

已排查信息

路径问题定位

错误源于命令行调用了错误的二进制文件路径:

  • 错误路径(不存在):~/Library/Android/sdk/emulator/qemu/darwin-x86_64/qemu-system-aarch64
  • 正确路径(实际存在):~/Library/Android/sdk/emulator/qemu/darwin-aarch64/qemu-system-aarch64

-verbose输出验证

带-verbose参数执行命令后,确认模拟器确实在尝试调用错误路径的二进制文件,关键输出片段:

emulator:Found target-specific 64-bit emulator binary: ~/Library/Android/sdk/emulator/qemu/darwin-x86_64/qemu-system-aarch64
emulator: Running :~/Library/Android/sdk/emulator/qemu/darwin-x86_64/qemu-system-aarch64
Could not launch '~/Library/Android/sdk/emulator/qemu/darwin-x86_64/qemu-system-aarch64': No such file or directory

系统与环境信息

  • Android Studio版本:Android Studio Iguana | 2023.2.1
  • JDK运行时版本:17.0.9+0-17.0.9b1087.7-11185874 aarch64
  • 虚拟设备配置:
    • 显示名称:Pixel 8 API 34
    • AVD ID:Pixel_8_API_34
    • API版本:34
    • 系统镜像路径:system-images/android-34/google_apis_playstore/arm64-v8a/

解决方案

方法1:直接调用新版emulator可执行文件

不要使用tools目录下的旧版启动脚本,直接调用emulator目录中的适配ARM架构的启动程序:

~/Library/Android/sdk/emulator/emulator @Pixel_8_API_34

tools/emulator是旧版脚本,在Apple Silicon环境下会错误识别架构,指向x86_64路径;而emulator/emulator是适配ARM的新版程序,能正确定位到darwin-aarch64下的二进制文件。

方法2:创建软链接临时修复

如果需要继续使用旧命令路径,可给错误路径创建软链接指向正确目录:

ln -s ~/Library/Android/sdk/emulator/qemu/darwin-aarch64 ~/Library/Android/sdk/emulator/qemu/darwin-x86_64

注意:此为临时修复,后续Android SDK更新可能导致链接失效,优先推荐方法1。

方法3:配置环境变量简化命令

将emulator目录添加到系统环境变量PATH,之后可直接使用emulator命令启动:

  1. 打开终端配置文件(如~/.zshrc或~/.bash_profile)
  2. 添加一行:
export PATH="$HOME/Library/Android/sdk/emulator:$PATH"
  1. 执行source ~/.zshrc(对应你的配置文件)使变更生效
  2. 之后直接执行:
emulator @Pixel_8_API_34

内容的提问来源于stack exchange,提问作者Wing

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.27 13:10:25