KMP项目iOS端编译失败:Command PhaseScriptExecution非零退出码错误
KMP项目iOS模块构建触发PhaseScriptExecution错误(M1 Mac环境)
环境配置
- 2020款MacBook Air M1(8GB)
- Xcode 15.3
- Android Studio Iguana 2023.2.1
问题详情
构建Kotlin Multiplatform(KMP)项目的iOS APP模块时,频繁触发PhaseScriptExecution错误:
- 无论使用Xcode还是Android Studio构建,都会触发该错误
- 无论是直接在Android Studio创建项目,还是通过JetBrains的KMP向导生成项目,问题均会出现
- 仅iOS模块存在此问题,Android设备或模拟器上可正常构建并运行应用
网上查到的解决方案大多建议修改framework.sh文件,但我的项目无论是否初始化Pod,都找不到这个文件。项目为Android Studio创建的标准KMP项目。
另外,kdoctor提示Cocoapods未安装,但实际上已安装,且在普通Xcode项目中可正常使用。
错误信息
Kdoctor诊断结果
Environment diagnose (to see all details, use -v option): [✓] Operation System [✓] Java [✓] Android Studio [✓] Xcode [!] CocoaPods ! CocoaPods configuration is not required, but highly recommended for full-fledged development ✖ System ruby is currently used CocoaPods is not compatible with system ruby installation on Apple M1 computers. Please install ruby via Homebrew, rvm, rbenv or other tool and make it default ✖ CocoaPods requires your terminal to be using UTF-8 encoding. Consider adding the following to ~/.zprofile export LC_ALL=en_US.UTF-8 Conclusion: ✓ Your operation system is ready for Kotlin Multiplatform Mobile Development!
Xcode构建错误
Command PhaseScriptExecution failed with a nonzero exit code
Android Studio详细构建错误
内容过长,可查看项目内的Android Studio error description文件
内容的提问来源于stack exchange,提问作者GamerBlind
相关产品推荐
相关产品推荐

