我正在使用 Firebase 设置我的 Flutter 项目。我已经使用
flutterfire configure
设置了它,我可以看到 firebase.json 是在我的应用程序的根目录中创建的。
我可以毫无问题地启动我的 Android 应用程序,并且可以看到我的 Android 版 Crashlytics 报告。问题出在 iOS 应用程序上,当我想启动该应用程序时,出现以下错误:
Unhandled exception:
PathNotFoundException: Cannot open file, path = '/Users/myusername/firebase.json' (OS Error: No such file or directory, errno = 2)
#0 _checkForErrorResponse (dart:io/common.dart:55:9)
#1 _File.open.<anonymous closure> (dart:io/file_impl.dart:381:7)
<asynchronous suspension>
#2 _File.readAsBytes.<anonymous closure> (dart:io/file_impl.dart:562:24)
<asynchronous suspension>
#3 _File.readAsString (dart:io/file_impl.dart:621:18)
<asynchronous suspension>
#4 appleConfigFromFirebaseJson (package:flutterfire_cli/src/common/utils.dart:286:7)
<asynchronous suspension>
#5 UploadCrashlyticsSymbols._getConfigurationFromFirebaseJsonFile (package:flutterfire_cli/src/commands/upload_symbols.dart:278:9)
<asynchronous suspension>
#6 UploadCrashlyticsSymbols.run (package:flutterfire_cli/src/commands/upload_symbols.dart:331:34)
<asynchronous suspension>
#7 CommandRunner.runCommand (package:args/command_runner.dart:212:13)
<asynchronous suspension>
#8 main (file:///Users/myusername/.pub-cache/hosted/pub.dev/flutterfire_cli-1.0.0/bin/flutterfire.dart:63:5)
<asynchronous suspension>
Command PhaseScriptExecution failed with a nonzero exit code
note: Removed stale file '/Users/myusername/Library/Developer/Xcode/DerivedData/Runner-egqrgdeioyfvqjgozczypudejvlm/Build/Intermediates.noindex/Runner.build/Debug-iphoneos/Runner.build/Script-AA5FB794F195D0E14D219BF0.sh'
知道为什么会发生这种情况吗?
根据 @Nhật Trần 评论,我的问题是由于我的目录文件夹包含空间。删除空格后,我就不再遇到这个问题了。