【问题标题】:error: Build input file cannot be found: '/Users/GoogleService-Info.plist' (in target 'Runner' from project 'Runner')错误:找不到构建输入文件:'/Users/GoogleService-Info.plist'(在项目'Runner'的目标'Runner'中)
【发布时间】:2020-07-08 11:39:45
【问题描述】:

我正在尝试使用 Flutter 项目的 iOS 构建。无论我尝试什么,它只会给我以下错误:

错误:找不到构建输入文件:“/Users/GoogleService-Info.plist”(在项目“Runner”的目标“Runner”中)

这是我尝试构建的一组命令:

  • 颤振酒吧获取
  • 扑干净
  • flutter build ios(这会导致上述错误)

这是我的颤振医生输出

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel master, v1.16.3-pre.67, on Mac OS X 10.15.3 19D76, locale en-GB)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
[✓] Xcode - develop for iOS and macOS (Xcode 11.4)
[✓] Android Studio (version 3.5)
[✓] VS Code (version 1.43.2)
[!] Connected device

! Doctor found issues in 1 category.

flutter build ios --verbose 以以下错误结束:

Encountered error while building for the device.

#0      throwToolExit (package:flutter_tools/src/base/common.dart:14:3)
#1      BuildIOSCommand.runCommand (package:flutter_tools/src/commands/build_ios.dart:93:7)
<asynchronous suspension>
#2      FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:722:18)
#3      _rootRunUnary (dart:async/zone.dart:1155:38)
#4      _CustomZone.runUnary (dart:async/zone.dart:1048:19)
#5      _FutureListener.handleValue (dart:async/future_impl.dart:141:18)
#6      Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:682:45)
#7      Future._propagateToListeners (dart:async/future_impl.dart:711:32)
#8      Future._completeWithValue (dart:async/future_impl.dart:526:5)
#9      Future._asyncComplete.<anonymous closure> (dart:async/future_impl.dart:556:7)
#10     _rootRun (dart:async/zone.dart:1147:13)
#11     _CustomZone.run (dart:async/zone.dart:1040:19)
#12     _CustomZone.runGuarded (dart:async/zone.dart:942:7)
#13     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:982:23)
#14     _microtaskLoop (dart:async/schedule_microtask.dart:43:21)
#15     _startMicrotaskLoop (dart:async/schedule_microtask.dart:52:5)
#16     _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:118:13)
#17     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:169:5)

这是文件夹结构的图像。如您所见,没有保存 Google plist 的“用户”文件夹。因此,为什么脚本会尝试从不存在的目录中复制 plist 是非常令人困惑的。任何解决此问题的建议将不胜感激。 TIA :-)

【问题讨论】:

  • 删除它,然后再次尝试从 Xcode 将文件添加到目录中,然后根据需要选择复制项目并添加到目标复选标记。 Runner 目录中是否有 GoogleService-Info.plist 文件? (从 Finder 应用中查看)
  • 啊!我确实通过 VSCode 删除并添加回来。没有尝试使用 Xcode。似乎正在工作。我会在执行结束时确认。

标签: ios xcode flutter flutter-build


【解决方案1】:

删除GoogleService-Info.plist,然后再次使用Xcode将文件添加到Runner目录,然后选择copy items if neededadd to target复选标记。我希望这能解决您的问题。

【讨论】:

  • 仍然找不到 GoogleService-Info.plist 文件
【解决方案2】:

最终我找到了解决方法:

  1. 从 Firebase 下载新的 GoogleService-Info.plist 文件

  2. 将它放在你的 Flutter 项目的ios/Runner 目录中(将 GoogleService-Info.plist 放到 Runner 目录中而不是在 XCode 中)

  3. 使用 open ios/Runner.xcworkspace 打开 XCode

  4. 在 XCode 中,将文件 GoogleService-Info.plist 从查找器拖到蓝色 RunnerProject 下方的黄色 Runner 文件夹中(在屏幕左侧的项目导航器中)

  1. 接下来,flutter run

【讨论】:

  • 这应该标记为正确答案,它完全解决了这个问题!
猜你喜欢
  • 2022-12-13
  • 2019-06-25
  • 2021-03-24
  • 2018-01-01
  • 2020-09-02
  • 2022-12-23
  • 2020-01-14
  • 2019-06-16
  • 2020-09-01
相关资源
最近更新 更多