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

KMM项目Android Studio中Execution target列表为空,无法选择iOS运行目标

解决Android Studio中KMM项目看不到iPhone模拟器运行目标的问题
  • 检查KMM插件与Android Studio版本兼容性
    确保Android Studio为北极狐(Arctic Fox)及以上版本,打开Settings > Plugins > Marketplace搜索Kotlin Multiplatform Mobile,确认插件已启用并更新到适配当前AS的最新版本。

  • 验证Xcode命令行工具配置

    1. 终端执行xcode-select --install,确保Xcode命令行工具完成安装
    2. 执行xcode-select -p,确认输出为/Applications/Xcode.app/Contents/Developer,路径错误则用sudo xcode-select -s /Applications/Xcode.app/Contents/Developer修正
    3. 打开Xcode进入Xcode > Settings > Locations,确认Command Line Tools选择当前安装的Xcode版本
  • 重启相关服务与IDE

    1. 关闭Android Studio和Xcode,终端执行killall -9 simctl杀掉模拟器进程
    2. 重新打开Xcode,在Window > Devices and Simulators中确认至少有一个可用的iPhone模拟器(无则新建)
    3. 启动Android Studio,等待项目同步完成后查看运行目标列表
  • 检查KMM项目配置

    1. 打开项目根目录或iOS模块的build.gradle.kts,确认iOS目标配置正确,示例:
      ios {
          binaries {
              framework {
                  baseName = "shared"
              }
          }
      }
      
    2. 执行File > Sync Project with Gradle Files强制同步配置
  • 重置Android Studio缓存
    执行File > Invalidate Caches...,选择Invalidate and Restart清理缓存后重启IDE

  • 确认模拟器连接状态

    1. 终端执行xcrun simctl list devices,查看模拟器列表,确保存在Booted或Shutdown状态的iPhone模拟器
    2. 若模拟器状态异常,在Xcode中删除并重新创建模拟器,再回到Android Studio查看

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.11 20:20:34