Apple Silicon Android Studio 模拟器:错误:找不到模拟器可执行文件

Posted

技术标签:

【中文标题】Apple Silicon Android Studio 模拟器:错误:找不到模拟器可执行文件【英文标题】:Apple Silicon Android Studio emulator: ERROR: can't find the emulator executable 【发布时间】:2021-09-19 05:40:26 【问题描述】:

我刚刚在我的 Apple M1 Macbook 上安装了 android Studio 4.2.2Android Studio Preview (Arctic Fox Beta 5)

创建模拟器时 (arm64) 我立即收到错误:

AVD Manager: The emulator process for AVD Pixel_4a_API_30 has terminated

然后我转到 Android Studio 的日志文件(帮助 > 在 Finder 中显示日志),我看到当 Android Studio 尝试运行以下内容时出现错误:

~/Library/Android/sdk/emulator/emulator -netdelay none -netspeed full -no-snapshot-load -avd Pixel_4a_API_30

哪个输出:

emulator: Android emulator version 30.3.5.0 (build_id 7036990) (CL:N/A)
emulator: ERROR: can't find the emulator executable.

尝试了迄今为止我在网上找到的所有可能的解决方案......

【问题讨论】:

【参考方案1】:

在阅读m1 emulator GitHub page 的自述文件后,我遇到了同样的问题并找到了一个简单的解决方案。

如果我是对的,那么您正在尝试启动为不同架构构建的映像。选择镜像时,需要切换到“Other Images”选项卡,寻找ABI栏中注明arm64-*的镜像。其他一切都应该在之后工作。

解决步骤

    打开 AVD 管理器并单击 + Create Virtual Device 选择您想要的设备并点击Next 将选项卡切换到“其他图像” Android Studio Select Arm64 Virtual Device Image 完成创建过程并运行您的应用。

【讨论】:

类似问题的解决方案建议修改 PATH 变量并没有解决我的问题。 Alexandr 的上述回答解决了我在配备 Apple M1 处理器的 Mac mini 上的问题。 我做了以上。我说我使用的是Arctic Fox beta 5,使用该版本Android Studio会默认为您提供arm64版本(无需转到“其他图像”选项卡) 我明白了。我没有尝试过北极狐 Beta,但 Android Studio 4.2.2 使用了他的方法。【参考方案2】:

最新的 Android Studio for Apple Chip 版本解决了我的问题。

【讨论】:

在 Mac M1 上使用模拟器运行您的应用程序需要一些特殊配置(根据 Alexandr Sarioglo 的回答):1) 从 ADV Manager > 添加 > 选择模型 > 下一步 > 从特殊图像 转到特殊图像选项卡并从 ABI 列中选择任何 arm64-* 值(只有带有 arm64-* 的模拟器在 M1 船上正常工作)2)显示高级设置以增加设备存储(特别是 API 级别 31 及以上)避免“空间不足”异常。 在我写这个问题时,我已经在使用 Artic Fox Beta 5,这意味着 arm64 不再位于特殊选项卡中,而是默认应用。请参阅我上面的评论。

以上是关于Apple Silicon Android Studio 模拟器:错误:找不到模拟器可执行文件的主要内容,如果未能解决你的问题,请参考以下文章

Android Studio:“AVD Pixel_2_API_30 的模拟器进程已终止。”在 MacBook Pro M1(Apple Silicon)上

在 Intel 机器上构建 Apple Silicon 二进制文件

从命令行检测 Apple Silicon

在 JavaScript 中检测 Apple Silicon mac

解决在Apple Silicon (M1)安装php MongoDB扩展失败

在 Apple Silicon xcode 上找不到 Swiftlint