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命令行工具配置
- 终端执行
xcode-select --install,确保Xcode命令行工具完成安装 - 执行
xcode-select -p,确认输出为/Applications/Xcode.app/Contents/Developer,路径错误则用sudo xcode-select -s /Applications/Xcode.app/Contents/Developer修正 - 打开Xcode进入
Xcode > Settings > Locations,确认Command Line Tools选择当前安装的Xcode版本
- 终端执行
重启相关服务与IDE
- 关闭Android Studio和Xcode,终端执行
killall -9 simctl杀掉模拟器进程 - 重新打开Xcode,在
Window > Devices and Simulators中确认至少有一个可用的iPhone模拟器(无则新建) - 启动Android Studio,等待项目同步完成后查看运行目标列表
- 关闭Android Studio和Xcode,终端执行
检查KMM项目配置
- 打开项目根目录或iOS模块的
build.gradle.kts,确认iOS目标配置正确,示例:ios { binaries { framework { baseName = "shared" } } } - 执行
File > Sync Project with Gradle Files强制同步配置
- 打开项目根目录或iOS模块的
重置Android Studio缓存
执行File > Invalidate Caches...,选择Invalidate and Restart清理缓存后重启IDE确认模拟器连接状态
- 终端执行
xcrun simctl list devices,查看模拟器列表,确保存在Booted或Shutdown状态的iPhone模拟器 - 若模拟器状态异常,在Xcode中删除并重新创建模拟器,再回到Android Studio查看
- 终端执行
内容的提问来源于stack exchange,提问作者Valentina Ramirez
相关产品推荐
相关产品推荐

