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

问题描述

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

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
               [        ]    ^

到目前为止我尝试过的:

  • Flutter clean
  • Flutter pub cache repair
  • 重建 iOS 文件
  • 清理构建文件
  • pod update && pod install
  • Flutter upgrade
  • 检查 !use_frameworks 在 podfile 中的使用

以及 XCode 中的其他配置更改,例如“仅用于安装”的脚本等...

我唯一看到的是问题来自我正在使用的软件包,例如 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

编辑:它似乎来自ri​​verpod 0.12.4。 更新到最新版本产生了另一个错误,但需要代码重构,如果重构后问题解决,我会更新。

解决方法

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

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

Github issue regarding riverpod

Migration guide