首页 > 解决方案 > 添加依赖后 Flutter 构建失败

问题描述

在我尝试安装flutter_statusbarcolor包后构建失败。在我做之前一切都很好,我正在使用 Mac 和 XCode 模拟器。我只想更改状态栏的颜色。这种方法行不通。

$ flutter run
Launching lib/main.dart on iPhone Xʀ in debug mode...
Running Xcode build...                                                  
Xcode build done.                                            1,3s
Failed to build iOS app
Error output from Xcode build:
↳
    ** BUILD FAILED **


Xcode's output:
↳
    note: Using new build systemnote: Planning buildnote: Constructing build descriptionerror: /Users/Bob/Documents/Projects/Flutter/gp/ios/Flutter/Debug.xcconfig:1: could not find included file
    'Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig' in search paths (in target 'Runner' from project 'Runner')error:
    /Users/Bob/Documents/Projects/Flutter/gp/ios/Flutter/Debug.xcconfig:1: could not find included file 'Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig' in search paths (in target
    'Runner' from project 'Runner')error: /Users/Bob/Documents/Projects/Flutter/gp/ios/Flutter/Debug.xcconfig:1: could not find included file 'Pods/Target Support
    Files/Pods-Runner/Pods-Runner.debug.xcconfig' in search paths (in target 'Runner' from project 'Runner')error: /Users/Bob/Documents/Projects/Flutter/gp/ios/Flutter/Debug.xcconfig:1: could not find
    included file 'Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig' in search paths (in target 'Runner' from project 'Runner')error:
    /Users/Bob/Documents/Projects/Flutter/gp/ios/Flutter/Debug.xcconfig:1: could not find included file 'Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig' in search paths (in target
    'Runner' from project 'Runner')error: /Users/Bob/Documents/Projects/Flutter/gp/ios/Flutter/Debug.xcconfig:1: could not find included file 'Pods/Target Support
    Files/Pods-Runner/Pods-Runner.debug.xcconfig' in search paths (in target 'Runner' from project 'Runner')

Could not build the application for the simulator.
Error launching application on iPhone Xʀ.

然后我从依赖项和~/.pub-cache/hosted/pub.dartlang.org/目录中的所有文件中删除了这个包。但是 Flutter 仍然会抛出同样的错误。如何恢复我的应用程序并原生更改状态栏的颜色?

标签: iosflutterdartflutter-dependenciesdart-pub

解决方案


这帮助了我:

转到 ios 目录并输入pod install

参考:https ://github.com/X-Wei/flutter_catalog/issues/26#issuecomment-548923989


推荐阅读