Macos 部署目标 firestore/firebase_core

Posted

技术标签:

【中文标题】Macos 部署目标 firestore/firebase_core【英文标题】:Macosx Deployment target firestore/firebase_core 【发布时间】:2021-07-14 04:43:08 【问题描述】:

您好,当我运行包含 firestore/firebase_core 的 Flutter 代码时出现此错误 我尝试了多个部署目标,但仍然出现错误

Launching lib/main.dart on macOS in debug mode...
Building macOS application...
Error: Cannot run with sound null safety, because the following dependencies
don't support null safety:

 - package:firebase_core
 - package:firebase_core_platform_interface
 - package:quiver
 - package:plugin_platform_interface
 - package:cloud_firestore
 - package:cloud_firestore_platform_interface

For solutions, see https://dart.dev/go/unsound-null-safety

Command PhaseScriptExecution failed with a nonzero exit code
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description
warning: The macOS deployment target 'MACOSX_DEPLOYMENT_TARGET' is set to 10.7, but the range of supported deployment target versions is 10.9 to 11.0.99. (in target 'BoringSSL-GRPC' from project 'Pods')
warning: The macOS deployment target 'MACOSX_DEPLOYMENT_TARGET' is set to 10.6, but the range of supported deployment target versions is 10.9 to 11.0.99. (in target 'nanopb' from project 'Pods')
warning: The macOS deployment target 'MACOSX_DEPLOYMENT_TARGET' is set to 10.7, but the range of supported deployment target versions is 10.9 to 11.0.99. (in target 'leveldb-library' from project 'Pods')
** BUILD FAILED **

Exception: Build process failed

【问题讨论】:

【参考方案1】:

发生此错误是因为您尝试使用不支持 null 安全性的库来运行您的应用程序。您可以通过使用以下命令运行您的应用程序来解决此问题:

flutter run --no-sound-null-safety

如果您使用的是 IDE,则需要更改运行配置,例如在 VSCode 中:

Code => Preferences => Settings => 搜索设置,输入“flutter test” => Dart: Flutter Test Additional Args, Add item => Add "--no-sound-null-safety

我建议您查看this 链接以了解如何更好地理解此错误。

【讨论】:

以上是关于Macos 部署目标 firestore/firebase_core的主要内容,如果未能解决你的问题,请参考以下文章

macOS Simulator 部署目标设置为 13.5,但此平台支持的部署目标版本范围为 13.1 到 13.4.999

如何使用firestore在当前用户文档中添加数据?

如何为特定部署 macOS 版本编译 OpenSSL 库?

未找到目标文件“macos”

Kotlin Multiplatform:共享多个目标(iOS、macOS)的实际类实现

为`swift package generate-xcodeproj`设置macOS目标?