添加依赖项后Flutter构建失败

时间:2019-10-01 13:57:23

标签: ios flutter dart flutter-dependencies dart-pub

我尝试安装flutter_statusbarcolor软件包后,构建失败。一切正常,然后再使用Mac和iPhone模拟器。我只想更改状态栏的颜色。 This approach不起作用。

$ 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ʀ.

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

3 个答案:

答案 0 :(得分:2)

也许缺少依赖项

要修复,您需要获取软件包并安装Pod。

  1. 打开终端,导航到项目并输入
  2. flutter clean
  3. flutter pub get
  4. 运行pod install

答案 1 :(得分:1)

添加

path_provider: 1.6.1 

pubspec.yaml ,然后 然后

flutter pub get

答案 2 :(得分:0)

这对我有帮助:

  

转到ios目录,然后输入pod install

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