首页 > 解决方案 > Flutter webview_flutter 构建失败

问题描述

我正在尝试安装 webview_flutter 插件,但不知何故我的构建每次都失败

Launching lib/main.dart on iPhone 11 Pro in debug mode...

Running Xcode build...

 ├─Assembling Flutter resources...                          10.2s
 └─Compiling, linking and signing...                         2.1s
Xcode build done.
17.5s
Failed to build iOS app
Error output from Xcode build:
↳
    ** BUILD FAILED **


Xcode's output:
↳
    <path_to_project>ios/Runner/GeneratedPluginRegistrant.m:10:9: fatal
    error: module 'webview_flutter' not found
    @import webview_flutter;
     ~~~~~~~^~~~~~~~~~~~~~~
    1 error generated.
    note: Using new build system
    note: Building targets in parallel
    note: Planning build
    note: Constructing build description

Could not build the application for the simulator.
Error launching application on iPhone 11 Pro.

发布规范.yml

dependencies:
  flutter:
    sdk: flutter

  webview_flutter: ^0.3.19+8

我尝试运行但它没有解决它。

flutter clean

flutter pub cache repair

标签: flutterwebview

解决方案


就我而言,问题是我手动编辑了 podfile 以将我自己的(非颤振)pod 添加到项目中。但是,flutter 构建不会尝试编辑(或覆盖)podfile,(也许这很好)所以 podfile 不会有支持 webview_flutter 所需的更改。我通过创建一个全新的颤振项目并将新项目生成的 podfile 与我当前的版本进行比较来解决这一切。他们看起来明显不同。


推荐阅读