Flutter webview_flutter构建失败

时间:2020-04-13 19:31:15

标签: flutter webview

我正在尝试安装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.

pubspec.yml

dependencies:
  flutter:
    sdk: flutter

  webview_flutter: ^0.3.19+8

我尝试跑步,但无法解决问题。

flutter clean

flutter pub cache repair

2 个答案:

答案 0 :(得分:0)

您是否已针对该插件执行 iOS的所有安装

这来自webview_flutter页面本身:

要在iOS上使用此插件,您需要加入嵌入式视图 通过向应用程序的Info.plist文件中添加布尔属性进行预览, 并使用键io.flutter.embedded_views_preview和值为YES。

这似乎也与之相关,请看一下:https://github.com/flutter/flutter/issues/50190

答案 1 :(得分:0)

就我而言,问题是我手动编辑了podfile,以将我自己的(非浮动)pod添加到项目中。但是,Flutter构建不会尝试编辑(或覆盖)podfile,(这可能很好),因此,podfile不会具有支持webview_flutter所需的更改。通过创建一个全新的flutter项目并将新项目的生成的podfile与我的当前版本进行比较,我弄清楚了这一切。他们看起来大不相同。