Flutter打包报Command PhaseScriptExecution failed with a nonzero exit code

打包Flutter的app Xcode报错如下

building file list ... rsync: link_stat "/Users/Singer/work/iOSProject/xxx/ios/Flutter/App.framework" failed: No such file or directory (2)
done

sent 29 bytes  received 20 bytes  98.00 bytes/sec
total size is 0  speedup is 0.00
rsync error: some files could not be transferred (code 23) at /System/Volumes/Data/SWE/macOS/BuildRoots/e90674e518/Library/Caches/com.apple.xbs/Sources/rsync/rsync-55/rsync/main.c(996) [sender=2.6.9]
Command PhaseScriptExecution failed with a nonzero exit code

由于在命令行执行了flutter clean命令,会把App.framework给删除
所以导致找不到这个文件

解决方案
在Thin Binary中embed_and_thin改成build
然后在点击Product--->Archive进行打包


image.png

如果打包出来后安装到手机上 白屏并且会闪退,请再把Thin Binary中build改成embed_and_thin
再重新Product--->Archive进行打包一次

但是这样的方法始终不太好
最终经过我研究找到方法

下图中顺序可能有关系


36221623057483_.pic.jpg
image.png
xcrun agvtool next-version -all

这个next-version是打包的时候build号 自动加1,无需在意

image.png

你可能感兴趣的:(Flutter打包报Command PhaseScriptExecution failed with a nonzero exit code)