Flutter发行版无法从终端构建

时间:2019-06-14 20:31:57

标签: ios flutter release

我正在努力构建自己的应用程序以部署到应用程序商店。当我尝试通过命令行进行构建时,构建失败并出现链接器错误。如果我直接通过Product-> Archive在Xcode 10.2中尝试相同的构建,则构建成功完成。我正在使用稳定频道中的最新版本。

我尝试完全卸载Pods并重新启动,但这不会更改错误。

rm -rf ~/Library/Caches/CocoaPods
rm -rf Pods
rm -rf ~/Library/Developer/Xcode/DerivedData/*
pod deintegrate
pod setup
pod install

我还尝试删除所有具有平台特定代码的Pod,但仍无法使用下面的命令进行构建。

我用于构建的命令是

flutter build ios --release --no-codesign

我稍后在此过程中使用fastlane完成构建(签名并上传到App Store)

终端构建错误如下所示

ld: framework not found App
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    ld: framework not found App
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    === BUILD TARGET Runner OF PROJECT Runner WITH CONFIGURATION Release ===
    error: the following command failed with exit code 1 but produced no further output
    Ld /Users/admin/Library/Developer/Xcode/DerivedData/Runner-dhbqkotqxaizmcalpjzdyswlcahi/Build/Intermediates.noindex/Runner.build/Release-iphoneos/Runner.build/Objects-normal/arm64/Runner normal arm64

1 个答案:

答案 0 :(得分:0)

我发现,只要在运行flutter build之前至少运行一次xcode归档文件,所有将来的Flutter构建都将成功运行。在我的构建服务器上,我每次都必须运行xcode存档,因为它是一个共享的构建服务器,在构建后会被清除。对于那些偶然发现以下问题的人来说,这些命令对我有用

cd ios

pod repo update

pod install

xcodebuild -workspace Runner.xcworkspace -scheme Runner -destination generic/platform=iOS archive CODE_SIGN_IDENTITY="" FLUTTER_ROOT="/Users/builder/programs/flutter" CODE_SIGNING_REQUIRED=NO 

flutter build ios --release --no-codesign 
相关问题