Xcode 无法为 ios 13.3.1 设备构建 flutter 代码,但在 13.3 ios 模拟器上运行代码

Xcode fails to build flutter code for ios 13.3.1 device but runs code on 13.3 ios simulator

下面是我在 Xcode 11.3.1 和 ios 13.3.1 上得到的。我该怎么办? 该代码在 ios 模拟器上运行,并且为其构建总是成功的。那么问题在哪里呢?这里有什么问题,或者我在这里遗漏了什么? 我确实尝试了 clear / install pods 方法,但没有任何效果。

iMac:x me$ flutter build  ios
The plugin `device_id` is built using an older version of the Android plugin API which assumes that it's running in a full-Flutter environment. It may have undefined
behaviors when Flutter is integrated into an existing app as a module.
The plugin can be updated to the v2 Android Plugin APIs by following https://flutter.dev/go/android-plugin-migration.
Building com.x.demo for device (ios-release)...

Automatically signing iOS for device deployment using specified development team in Xcode project: MHUCCU5SX2

Running pod install...                                              5.9s
Running Xcode build...                                                  

 ├─Building Dart code...                                    61.5s
 ├─Generating dSYM file...                                   1.0s
 ├─Stripping debug symbols...                                0.9s
 ├─Assembling Flutter resources...                           1.9s
 └─Compiling, linking and signing...                        20.5s
Xcode build done.                                           239.8s
Failed to build iOS app
Error output from Xcode build:
↳
    ** BUILD FAILED **


Xcode's output:
↳
    The plugin `device_id` is built using an older version of the Android plugin API which assumes that it's running in a full-Flutter environment. It may have
    undefined behaviors when Flutter is integrated into an existing app as a module.
    The plugin can be updated to the v2 Android Plugin APIs by following https://flutter.dev/go/android-plugin-migration.
    Building AOT snapshot in release mode (ios-release)...          
    Building App.framework for arm64...

    Building App.framework for armv7...
    Building AOT snapshot in release mode (ios-release)...             60.1s
    Built to build/aot/.
    warning: parsing line table prologue at offset 0x6f697463 found unsupported version 0x00
    warning: line table parameters mismatch. Cannot emit.
    note: while processing /Users/me/AndroidStudioProjects/x/build/aot/armv7/snapshot_assembly.o
    The plugin `device_id` is built using an older version of the Android plugin API which assumes that it's running in a full-Flutter environment. It may have
    undefined behaviors when Flutter is integrated into an existing app as a module.
    The plugin can be updated to the v2 Android Plugin APIs by following https://flutter.dev/go/android-plugin-migration.
    Project /Users/me/AndroidStudioProjects/x built and packaged successfully.
    ld: warning: ignoring file /Users/me/AndroidStudioProjects/x/ios/Flutter/App.framework/App, building for iOS-armv7 but
    attempting to link with file built for iOS Simulator-x86_64
    ld: warning: ignoring file /Users/me/AndroidStudioProjects/x/ios/Flutter/App.framework/App, building for iOS-arm64 but
    attempting to link with file built for iOS Simulator-x86_64
    error: the following command failed with exit code 0 but produced no further output
    Ld
    /Users/me/Library/Developer/Xcode/DerivedData/Runner-axlithrrzxajtgfxqkefalkhujgj/Build/Intermediates.noindex/Runner.build/Release-iphoneos/Runner.build/Objec
    ts-normal/arm64/Binary/Runner normal arm64
    /* com.apple.actool.document.warnings */
    /Users/me/AndroidStudioProjects/x/ios/Runner/Assets.xcassets:./AppIcon.appiconset/(null)[2d][Icon-App-50x50@1x.png]: warning:
    The app icon set "AppIcon" has 6 unassigned children.
    /Users/me/AndroidStudioProjects/x/ios/Runner/Assets.xcassets:./AppIcon.appiconset/(null)[2d][Icon-App-50x50@1x.png]: warning:
    The app icon set "AppIcon" has 6 unassigned children.
    /* com.apple.actool.compilation-results */
    /Users/me/AndroidStudioProjects/x/build/ios/Release-iphoneos/Runner.app/AppIcon20x20@2x.png
    /Users/me/AndroidStudioProjects/x/build/ios/Release-iphoneos/Runner.app/AppIcon20x20@3x.png
    /Users/me/AndroidStudioProjects/x/build/ios/Release-iphoneos/Runner.app/AppIcon29x29.png
    /Users/me/AndroidStudioProjects/x/build/ios/Release-iphoneos/Runner.app/AppIcon29x29@2x.png
    /Users/me/AndroidStudioProjects/x/build/ios/Release-iphoneos/Runner.app/AppIcon29x29@3x.png
    /Users/me/AndroidStudioProjects/x/build/ios/Release-iphoneos/Runner.app/AppIcon40x40@2x.png
    /Users/me/AndroidStudioProjects/x/build/ios/Release-iphoneos/Runner.app/AppIcon40x40@3x.png
    /Users/me/AndroidStudioProjects/x/build/ios/Release-iphoneos/Runner.app/AppIcon60x60@2x.png
    /Users/me/AndroidStudioProjects/x/build/ios/Release-iphoneos/Runner.app/AppIcon60x60@3x.png
    /Users/me/AndroidStudioProjects/x/build/ios/Release-iphoneos/Runner.app/AppIcon20x20~ipad.png
    /Users/me/AndroidStudioProjects/x/build/ios/Release-iphoneos/Runner.app/AppIcon20x20@2x~ipad.png
    /Users/me/AndroidStudioProjects/x/build/ios/Release-iphoneos/Runner.app/AppIcon29x29~ipad.png
    /Users/me/AndroidStudioProjects/x/build/ios/Release-iphoneos/Runner.app/AppIcon29x29@2x~ipad.png
    /Users/me/AndroidStudioProjects/x/build/ios/Release-iphoneos/Runner.app/AppIcon40x40~ipad.png
    /Users/me/AndroidStudioProjects/x/build/ios/Release-iphoneos/Runner.app/AppIcon40x40@2x~ipad.png
    /Users/me/AndroidStudioProjects/x/build/ios/Release-iphoneos/Runner.app/AppIcon76x76~ipad.png
    /Users/me/AndroidStudioProjects/x/build/ios/Release-iphoneos/Runner.app/AppIcon76x76@2x~ipad.png
    /Users/me/AndroidStudioProjects/x/build/ios/Release-iphoneos/Runner.app/AppIcon83.5x83.5@2x~ipad.png
    /Users/me/AndroidStudioProjects/x/build/ios/Release-iphoneos/Runner.app/Assets.car
    /Users/me/Library/Developer/Xcode/DerivedData/Runner-axlithrrzxajtgfxqkefalkhujgj/Build/Intermediates.noindex/Runner.build/Release-iphoneos/Runner.build/asset
    catalog_generated_info.plist

    Non-fat binary /Users/me/AndroidStudioProjects/x/build/ios/Release-iphoneos/Runner.app/Frameworks/App.framework/App is not
    armv7. Running lipo -info:
    Non-fat file: /Users/me/AndroidStudioProjects/x/build/ios/Release-iphoneos/Runner.app/Frameworks/App.framework/App is
    architecture: x86_64
    Command PhaseScriptExecution failed with a nonzero exit code
    note: Using new build system
    note: Planning build
    note: Constructing build description

这是 iOS 13.3.1 签名的一个已知问题。目前没有解决方案。当前选项包括:

  1. 使用模拟设备(而不是物理设备iPhone)
  2. 使用旧 iOS 版本的设备
  3. 使用付费开发者账户(非个人团队)

查看包含最新信息的讨论:

https://github.com/flutter/flutter/issues/49504

已确认此问题已在 iOS 13.4 beta 3 (17E5241d) 版本中得到修复。

对我来说,解决方案是转移到遗留模式构建from新构建`,一切正常!