使用 Flutter 构建 iOS 应用程序时出错 - 缺少 DVTPlugInCompatibilityUUID 插件

Error building iOS app with Flutter - Missing DVTPlugInCompatibilityUUID plugin

我在周末之前发布了一个构建,一切正常,我周一回来,无法构建。在过去的几天里,我一直坚持这个问题,我一直在尝试互联网上的大部分内容,但我似乎找不到解决方案。

XCode 构建未能指定缺少的插件(我猜是从基本的 Flutter 安装):

[        ] Xcode build done.                                           50.6s
[        ] Failed to build iOS app
[        ] Error output from Xcode build:
           ↳
[        ]     2021-06-10 09:23:10.255 xcodebuild[64069:7134747] [MT] PluginLoading: Required plug-in compatibility UUID F56A1938-53DE-493D-9D64-87EE6C415E4D for plug-in at path '~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/CocoaPods.xcplugin' not present in DVTPlugInCompatibilityUUIDs
               2021-06-10 09:23:10.255 xcodebuild[64069:7134747] [MT] PluginLoading: Required plug-in compatibility UUID F56A1938-53DE-493D-9D64-87EE6C415E4D for plug-in at path '~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/Alcatraz.xcplugin' not present in DVTPlugInCompatibilityUUIDs
               ** BUILD FAILED **

然后生成关于 Riverpod 的错误

               [+5009 ms] ../../flutter/.pub-cache/hosted/pub.dartlang.org/riverpod-0.12.4/lib/src/common.freezed.dart:121:4: Error: Getter not found: 'nullable'.
               [   +2 ms]   @nullable
               [        ]    ^^^^^^^^
               [   +5 ms] ../../flutter/.pub-cache/hosted/pub.dartlang.org/riverpod-0.12.4/lib/src/common.freezed.dart:121:4: Error: This can't be used as an annotation; an annotation should be a reference to a compile-time constant variable, or a call to a constant constructor.
               [        ]   @nullable
               [        ]    ^
               [   +1 ms] ../../flutter/.pub-cache/hosted/pub.dartlang.org/riverpod-0.12.4/lib/src/common.freezed.dart:206:4: Error: Getter not found: 'nullable'.
               [        ]   @nullable
               [        ]    ^^^^^^^^
               [        ] ../../flutter/.pub-cache/hosted/pub.dartlang.org/riverpod-0.12.4/lib/src/common.freezed.dart:206:4: Error: This can't be used as an annotation; an annotation should be a reference to a compile-time constant variable, or a call to a constant constructor.
               [        ]   @nullable
               [        ]    ^

到目前为止我尝试过的:

以及 XCode 中的其他配置更改,例如脚本 'for install only' 等...

我唯一看到的是问题出在我正在使用的包中,例如 Firebase Core。他们在大约一年前遇到了类似的问题,我们必须降级软件包版本才能构建并且错误类似,这里的问题是我试图从 1.2.1 降级到 0.7.0 但问题仍然存在,直到它会产生依赖性问题。 我认为 flutter_svg 也发生了同样的问题,这是由于一项重大更改导致必须更新 flutter_svg 或降级 flutter。

另外,难道我还没有迁移到健全的空安全?

如果您知道如何调试它,那将非常有帮助。 (有些东西我可以 运行 有更多关于错误的信息)。

这是我的 flutter doctor 和 pubspec 文件:

扑博士:

[✓] Flutter (Channel stable, 2.2.1, on macOS 11.3 20E232 darwin-x64, locale en-FR)
    • Flutter version 2.2.1 at /Users/Wapazz/Development/flutter
    • Framework revision 02c026b03c (2 weeks ago), 2021-05-27 12:24:44 -0700
    • Engine revision 0fdb562ac8
    • Dart version 2.13.1

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at /Users/Wapazz/Library/Android/sdk
    • Platform android-30, build-tools 29.0.2
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.5, Build version 12E262
    • CocoaPods version 1.10.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 3.5)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 42.1.1
    • Dart plugin version 191.8593
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)

[✓] Connected device (2 available)
    • iPhone 11 (mobile) • 519E686E-DEDD-4859-8D8D-EA775DB7149D • ios            • com.apple.CoreSimulator.SimRuntime.iOS-14-5 (simulator)
    • Chrome (web)       • chrome                               • web-javascript • Google Chrome 91.0.4472.77

• No issues found!

Pubspec.yaml:

dependencies:
  flutter:
    sdk: flutter
  cloud_firestore: ^2.2.2
  country_code_picker: ^2.0.1
  dropdown_formfield: ^0.1.3
  file_picker: ^3.0.2+2
  firebase_auth: ^1.4.1
  firebase_core: ^1.3.0
  firebase_storage: ^8.1.3
  flat_segmented_control: ^0.1.0
  flutter_dialogs: ^1.1.0
  flutter_keyboard_visibility: ^5.0.2
  flutter_radar_chart: ^0.2.0
  flutter_riverpod: ^0.12.4 #^0.14.0+3
  flutter_svg: ^0.22.0
  google_fonts: ^2.1.0
  image_picker: ^0.8.0+3
  introduction_screen: ^2.1.0
  modal_bottom_sheet: ^2.0.0
  shimmer: ^2.0.0
  video_player: ^2.1.6
  youtube_player_flutter: ^8.0.0

编辑:它似乎来自 riverpod 0.12.4。 更新到最新版本又报错,需要重构代码,重构后问题解决我再更新

在一一检查每个依赖项后,我找到了罪魁祸首。 问题出在riverpod 0.12.4,更新到最新版本解决了问题。

此外,为了使应用程序正常运行并修复由于新的 0.14.0 版本而导致的重大更改,还需要进行重构。

Github issue regarding riverpod

Migration guide