Flutter开发HarmonyOS鸿蒙Next应用的时候webview_flutter插件导致构建失败
Flutter开发HarmonyOS鸿蒙Next应用的时候webview_flutter插件导致构建失败
SDK和编译环境都是最新的 12 版本的。
1 ERROR: ArkTS:ERROR File: /Users/agan/.pub-cache/git/flutter_packages-e0b0f07cbe7e3ae3b9917b7d1c9c388833bf5561/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter. plugins/webview_flutter/GeneratedOhosWebView.ets:17:34 Cannot find module ‘@ohos/flutter_ohos/src/main/ets/plugin/common/StandardMessageCodec’ or its corresponding type declarations.
2 ERROR: ArkTS:ERROR File: /Users/agan/.pub-cache/git/flutter_packages-e0b0f07cbe7e3ae3b9917b7d1c9c388833bf5561/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter. plugins/webview_flutter/GeneratedOhosWebView.ets:18:28 Cannot find module ‘@ohos/flutter_ohos/src/main/ets/util/ByteBuffer’ or its corresponding type declarations.
3 ERROR: ArkTS:ERROR File: /Users/agan/.pub-cache/git/flutter_packages-e0b0f07cbe7e3ae3b9917b7d1c9c388833bf5561/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter. plugins/webview_flutter/GeneratedOhosWebView.ets:19:26 Cannot find module ‘@ohos/flutter_ohos/src/main/ets/plugin/common/MessageCodec’ or its corresponding type declarations.
4 ERROR: ArkTS:ERROR File: /Users/agan/.pub-cache/git/flutter_packages-e0b0f07cbe7e3ae3b9917b7d1c9c388833bf5561/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter. plugins/webview_flutter/GeneratedOhosWebView.ets:20:33 Cannot find module ‘@ohos/flutter_ohos/src/main/ets/plugin/common/BinaryMessenger’ or its corresponding type declarations.
5 ERROR: ArkTS:ERROR File: /Users/agan/.pub-cache/git/flutter_packages-e0b0f07cbe7e3ae3b9917b7d1c9c388833bf5561/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter. plugins/webview_flutter/GeneratedOhosWebView.ets:21:53 Cannot find module ‘@ohos/flutter_ohos/src/main/ets/plugin/common/BasicMessageChannel’ or its corresponding type declarations.
6 ERROR: ArkTS:ERROR File: /Users/agan/.pub-cache/git/flutter_packages-e0b0f07cbe7e3ae3b9917b7d1c9c388833bf5561/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter. plugins/webview_flutter/GeneratedOhosWebView.ets:216:44 Property ‘readValue’ does not exist on type ‘WebViewHostApiCodec’.
7 ERROR: ArkTS:ERROR File: /Users/agan/.pub-cache/git/flutter_packages-e0b0f07cbe7e3ae3b9917b7d1c9c388833bf5561/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter. plugins/webview_flutter/GeneratedOhosWebView.ets:1264:46 Property ‘readValue’ does not exist on type ‘WebChromeClientFlutterApiCodec’.
8 ERROR: ArkTS:ERROR File: /Users/agan/.pub-cache/git/flutter_packages-e0b0f07cbe7e3ae3b9917b7d1c9c388833bf5561/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter. plugins/webview_flutter/GeneratedOhosWebView.ets:2019:52 Property ‘readValue’ does not exist on type ‘WebViewClientFlutterApiCodec’.
9 ERROR: ArkTS:ERROR File: /Users/agan/.pub-cache/git/flutter_packages-e0b0f07cbe7e3ae3b9917b7d1c9c388833bf5561/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter. plugins/webview_flutter/GeneratedOhosWebView.ets:2021:54 Property ‘readValue’ does not exist on type ‘WebViewClientFlutterApiCodec’.
10 ERROR: ArkTS:ERROR File: /Users/agan/.pub-cache/git/flutter_packages-e0b0f07cbe7e3ae3b9917b7d1c9c388833bf5561/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter. plugins/webview_flutter/InstanceManager.ets:16:17 Cannot find module ‘@ohos/flutter_ohos/src/main/ets/util/Log’ or its corresponding type declarations.
11 ERROR: ArkTS:ERROR File: /Users/agan/.pub-cache/git/flutter_packages-e0b0f07cbe7e3ae3b9917b7d1c9c388833bf5561/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter. plugins/webview_flutter/CookieManagerHostApiImpl.ets:17:33 Cannot find module ‘@ohos/flutter_ohos/src/main/ets/plugin/common/BinaryMessenger’ or its corresponding type declarations.
12 ERROR: ArkTS:ERROR File: /Users/agan/.pub-cache/git/flutter_packages-e0b0f07cbe7e3ae3b9917b7d1c9c388833bf5561/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter. plugins/webview_flutter/CustomViewCallbackFlutterApiImpl.ets:16:33 Cannot find module ‘@ohos/flutter_ohos/src/main/ets/plugin/common/BinaryMessenger’ or its corresponding type declarations.
13 ERROR: ArkTS:ERROR File: /Users/agan/.pub-cache/git/flutter_packages-e0b0f07cbe7e3ae3b9917b7d1c9c388833bf5561/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter. plugins/webview_flutter/CustomViewCallbackHostApiImpl.ets:16:33 Cannot find module ‘@ohos/flutter_ohos/src/main/ets/plugin/common/BinaryMessenger’ or its corresponding type declarations.
14 ERROR: ArkTS:ERROR File: /Users/agan/.pub-cache/git/flutter_packages-e0b0f07cbe7e3ae3b9917b7d1c9c388833bf5561/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter. plugins/webview_flutter/DownloadListenerFlutterApiImpl.ets:17:33 Cannot find module ‘@ohos/flutter_ohos/src/main/ets/plugin/common/BinaryMessenger’ or its corresponding type declarations.
15 ERROR: ArkTS:ERROR File: /Users/agan/.pub-cache/git/flutter_packages-e0b0f07cbe7e3ae3b9917b7d1c9c388833bf5561/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter. plugins/webview_flutter/DynamicUtils.ets:16:35 Cannot find module ‘@ohos/flutter_ohos/src/main/ets/view/DynamicView/dynamicView’ or its corresponding type declarations.
16 ERROR: ArkTS:ERROR File: /Users/agan/.pub-cache/git/flutter_packages-e0b0f07cbe7e3ae3b9917b7d1c9c388833bf5561/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter. plugins/webview_flutter/FileChooserParamsFlutterApiImpl.ets:17:33 Cannot find module ‘@ohos/flutter_ohos/src/main/ets/plugin/common/BinaryMessenger’ or its corresponding type declarations.
17 ERROR: ArkTS:ERROR File: /Users/agan/.pub-cache/git/flutter_packages-e0b0f07cbe7e3ae3b9917b7d1c9c388833bf5561/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter. plugins/webview_flutter/FlutterAssetManager.ets:17:31 Cannot find module ‘@ohos/flutter_ohos/src/main/ets/embedding/engine/plugins/FlutterPlugin’ or its corresponding type declarations.
18 ERROR: ArkTS:ERROR File: /Users/agan/.pub-cache/git/flutter_packages-e0b0f07cbe7e3ae3b9917b7d1c9c388833bf5561/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter. plugins/webview_flutter/FlutterAssetManagerHostApiImpl.ets:18:17 Cannot find module ‘@ohos/flutter_ohos/src/main/ets/util/Log’ or its corresponding type declarations.
19 ERROR: ArkTS:ERROR File: /Users/agan/.pub-cache/git/flutter_packages-e0b0f07cbe7e3ae3b9917b7d1c9c388833bf5561/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter. plugins/webview_flutter/FlutterWebViewFactory.ets:17:17 Cannot find module ‘@ohos/flutter_ohos/src/main/ets/util/Log’ or its corresponding type declarations.
20 ERROR: ArkTS:ERROR File: /Users/agan/.pub-cache/git/flutter_packages-e0b0f07cbe7e3ae3b9917b7d1c9c388833bf5561/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter. plugins/webview_flutter/FlutterWebViewFactory.ets:18:34 Cannot find module ‘@ohos/flutter_ohos/src/main/ets/plugin/common/StandardMessageCodec’ or its corresponding type declarations.
21 ERROR: ArkTS:ERROR File: /Users/agan/.pub-cache/git/flutter_packages-e0b0f07cbe7e3ae3b9917b7d1c9c388833bf5561/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter. plugins/webview_flutter/FlutterWebViewFactory.ets:19:26 Cannot find module ‘@ohos/flutter_ohos/src/main/ets/plugin/platform/PlatformView’ or its corresponding type declarations.
22 ERROR: ArkTS:ERROR File: /Users/agan/.pub-cache/git/flutter_packages-e0b0f07cbe7e3ae3b9917b7d1c9c388833bf5561/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter. plugins/webview_flutter/FlutterWebViewFactory.ets:20:33 Cannot find module ‘@ohos/flutter_ohos/src/main/ets/plugin/platform/PlatformViewFactory’ or its corresponding type declarations.
23 ERROR: ArkTS:ERROR File: /Users/agan/.pub-cache/git/flutter_packages-e0b0f07cbe7e3ae3b9917b7d1c9c388833bf5561/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter. plugins/webview_flutter/GeolocationPermissionsCallbackFlutterApiImpl.ets:17:33 Cannot find module ‘@ohos/flutter_ohos/src/main/ets/plugin/common/BinaryMessenger’ or its corresponding type declarations.
24 ERROR: ArkTS:ERROR File: /Users/agan/.pub-cache/git/flutter_packages-e0b0f07cbe7e3ae3b9917b7d1c9c388833bf5561/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter. plugins/webview_flutter/GeolocationPermissionsCallbackHostApiImpl.ets:17:33 Cannot find module ‘@ohos/flutter_ohos/src/main/ets/plugin/common/BinaryMessenger’ or its corresponding type declarations.
25 ERROR: ArkTS:ERROR File: /Users/agan/.pub-cache/git/flutter_packages-e0b0f07cbe7e3ae3b9917b7d1c9c388833bf5561/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter. plugins/webview_flutter/HttpAuthHandlerFlutterApiImpl.ets:16:33 Cannot find module ‘@ohos/flutter_ohos/src/main/ets/plugin/common/BinaryMessenger’ or its corresponding type declarations.
26 ERROR: ArkTS:ERROR File: /Users/agan/.pub-cache/git/flutter_packages-e0b0f07cbe7e3ae3b9917b7d1c9c388833bf5561/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter. plugins/webview_flutter/HttpAuthHandlerHostApiImpl.ets:16:33 Cannot find module ‘@ohos/flutter_ohos/src/main/ets/plugin/common/BinaryMessenger’ or its corresponding type declarations.
27 ERROR: ArkTS:ERROR File: /Users/agan/.pub-cache/git/flutter_packages-e0b0f07cbe7e3ae3b9917b7d1c9c388833bf5561/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter. plugins/webview_flutter/JavaScriptChannelFlutterApiImpl.ets:17:33 Cannot find module ‘@ohos/flutter_ohos/src/main/ets/plugin/common/BinaryMessenger’ or its corresponding type declarations.
28 ERROR: ArkTS:ERROR File: /Users/agan/.pub-cache/git/flutter_packages-e0b0f07cbe7e3ae3b9917b7d1c9c388833bf5561/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter. plugins/webview_flutter/OhosWebView.ets:17:24 Cannot find module ‘@ohos/flutter_ohos/src/main/ets/plugin/platform/PlatformView’ or its corresponding type declarations.
29 ERROR: ArkTS:ERROR File: /Users/agan/.pub-cache/git/flutter_packages-e0b0f07cbe7e3ae3b9917b7d1c9c388833bf5561/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter. plugins/webview_flutter/OhosWebView.ets:19:21 Cannot find module ‘@ohos/flutter_ohos’ or its corresponding type declarations.
30 ERROR: ArkTS:ERROR File: /Users/agan/.pub-cache/git/flutter_packages-e0b0f07cbe7e3ae3b9917b7d1c9c388833bf5561/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter. plugins/webview_flutter/PermissionRequestFlutterApiImpl.ets:17:33 Cannot find module ‘@ohos/flutter_ohos/src/main/ets/plugin/common/BinaryMessenger’ or its corresponding type declarations.
31 ERROR: ArkTS:ERROR File: /Users/agan/.pub-cache/git/flutter_packages-e0b0f07cbe7e3ae3b9917b7d1c9c388833bf5561/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter. plugins/webview_flutter/ViewFlutterApiImpl.ets:16:33 Cannot find module ‘@ohos/flutter_ohos/src/main/ets/plugin/common/BinaryMessenger’ or its corresponding type declarations.
32 ERROR: ArkTS:ERROR File: /Users/agan/.pub-cache/git/flutter_packages-e0b0f07cbe7e3ae3b9917b7d1c9c388833bf5561/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter. plugins/webview_flutter/WebViewFlutterApiImpl.ets:16:33 Cannot find module ‘@ohos/flutter_ohos/src/main/ets/plugin/common/BinaryMessenger’ or its corresponding type declarations.
33 ERROR: ArkTS:ERROR File: /Users/agan/.pub-cache/git/flutter_packages-e0b0f07cbe7e3ae3b9917b7d1c9c388833bf5561/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter. plugins/webview_flutter/WebChromeClientFlutterApiImpl.ets:16:33 Cannot find module ‘@ohos/flutter_ohos/src/main/ets/plugin/common/BinaryMessenger’ or its corresponding type declarations.
34 ERROR: ArkTS:ERROR File: /Users/agan/.pub-cache/git/flutter_packages-e0b0f07cbe7e3ae3b9917b7d1c9c388833bf5561/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter. plugins/webview_flutter/WebChromeClientFlutterApiImpl.ets:18:25 Cannot find module ‘@ohos/flutter_ohos/src/main/ets/view/DynamicView/dynamicView’ or its corresponding type declarations.
35 ERROR: ArkTS:ERROR File: /Users/agan/.pub-cache/git/flutter_packages-e0b0f07cbe7e3ae3b9917b7d1c9c388833bf5561/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter. plugins/webview_flutter/WebViewClientFlutterApiImpl.ets:16:33 Cannot find module ‘@ohos/flutter_ohos/src/main/ets/plugin/common/BinaryMessenger’ or its corresponding type declarations.
36 ERROR: ArkTS:ERROR File: /Users/agan/.pub-cache/git/flutter_packages-e0b0f07cbe7e3ae3b9917b7d1c9c388833bf5561/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter. plugins/webview_flutter/WebChromeClientHostApiImpl.ets:16:17 Cannot find module ‘@ohos/flutter_ohos/src/main/ets/util/Log’ or its corresponding type declarations.
37 ERROR: ArkTS:ERROR File: /Users/agan/.pub-cache/git/flutter_packages-e0b0f07cbe7e3ae3b9917b7d1c9c388833bf5561/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter. plugins/webview_flutter/WebChromeClientHostApiImpl.ets:23:59 Cannot find module ‘@ohos/flutter_ohos/src/main/ets/view/DynamicView/dynamicView’ or its corresponding type declarations.
38 ERROR: ArkTS:ERROR File: /Users/agan/.pub-cache/git/flutter_packages-e0b0f07cbe7e3ae3b9917b7d1c9c388833bf5561/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter. plugins/webview_flutter/WebViewHostApiImpl.ets:16:38 Cannot find module ‘@ohos/flutter_ohos/src/main/ets/plugin/platform/PlatformView’ or its corresponding type declarations.
39 ERROR: ArkTS:ERROR File: /Users/agan/.pub-cache/git/flutter_packages-e0b0f07cbe7e3ae3b9917b7d1c9c388833bf5561/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter. plugins/webview_flutter/WebViewHostApiImpl.ets:17:44 Cannot find module ‘@ohos/flutter_ohos/src/main/ets/view/DynamicView/dynamicView’ or its corresponding type declarations.
40 ERROR: ArkTS:ERROR File: /Users/agan/.pub-cache/git/flutter_packages-e0b0f07cbe7e3ae3b9917b7d1c9c388833bf5561/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter. plugins/webview_flutter/WebViewHostApiImpl.ets:21:39 Cannot find module ‘@ohos/flutter_ohos/src/main/ets/view/DynamicView/dynamicViewJson’ or its corresponding type declarations.
41 ERROR: ArkTS:ERROR File: /Users/agan/.pub-cache/git/flutter_packages-e0b0f07cbe7e3ae3b9917b7d1c9c388833bf5561/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter. plugins/webview_flutter/WebViewHostApiImpl.ets:24:33 Cannot find module ‘@ohos/flutter_ohos/src/main/ets/plugin/common/BinaryMessenger’ or its corresponding type declarations.
42 ERROR: ArkTS:ERROR File: /Users/agan/.pub-cache/git/flutter_packages-e0b0f07cbe7e3ae3b9917b7d1c9c388833bf5561/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter. plugins/webview_flutter/WebViewHostApiImpl.ets:33:17 Cannot find module ‘@ohos/flutter_ohos/src/main/ets/util/Log’ or its corresponding type declarations.
43 ERROR: ArkTS:ERROR File: /Users/agan/.pub-cache/git/flutter_packages-e0b0f07cbe7e3ae3b9917b7d1c9c388833bf5561/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter. plugins/webview_flutter/PermissionRequestHostApiImpl.ets:17:31 Cannot find module ‘@ohos/flutter_ohos/src/main/ets/plugin/common/BinaryMessenger’ or its corresponding type declarations.
44 ERROR: ArkTS:ERROR File: /Users/agan/.pub-cache/git/flutter_packages-e0b0f07cbe7e3ae3b9917b7d1c9c388833bf5561/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter. plugins/webview_flutter/WebStorageHostApiImpl.ets:18:17 Cannot find module ‘@ohos/flutter_ohos/src/main/ets/util/Log’ or its corresponding type declarations.
45 ERROR: ArkTS:ERROR File: /Users/agan/.pub-cache/git/flutter_packages-e0b0f07cbe7e3ae3b9917b7d1c9c388833bf5561/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter. plugins/webview_flutter/WebViewFlutterPlugin.ets:16:53 Cannot find module ‘@ohos/flutter_ohos/src/main/ets/embedding/engine/plugins/FlutterPlugin’ or its corresponding type declarations.
46 ERROR: ArkTS:ERROR File: /Users/agan/.pub-cache/git/flutter_packages-e0b0f07cbe7e3ae3b9917b7d1c9c388833bf5561/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter. plugins/webview_flutter/WebViewFlutterPlugin.ets:17:28 Cannot find module ‘@ohos/flutter_ohos/src/main/ets/embedding/engine/plugins/PluginRegistry’ or its corresponding type declarations.
47 ERROR: ArkTS:ERROR File: /Users/agan/.pub-cache/git/flutter_packages-e0b0f07cbe7e3ae3b9917b7d1c9c388833bf5561/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter. plugins/webview_flutter/WebViewFlutterPlugin.ets:18:33 Cannot find module ‘@ohos/flutter_ohos/src/main/ets/plugin/common/BinaryMessenger’ or its corresponding type declarations.
48 ERROR: ArkTS:ERROR File: /Users/agan/.pub-cache/git/flutter_packages-e0b0f07cbe7e3ae3b9917b7d1c9c388833bf5561/packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter. plugins/webview_flutter/WebViewFlutterPlugin.ets:19:34 Cannot find module ‘@ohos/flutter_ohos/src/main/ets/plugin/platform/PlatformViewRegistry’ or its corresponding type declarations.
COMPILE RESULT:FAIL {ERROR:49 WARN:745}
在Flutter开发HarmonyOS(鸿蒙)Next应用时,遇到webview_flutter
插件导致构建失败的问题,通常可能由以下几个原因引起:
-
插件兼容性问题:
webview_flutter
插件可能未完全适配HarmonyOS平台。需确认插件版本是否支持HarmonyOS开发,并查看其官方文档或仓库是否有针对HarmonyOS的特定说明或分支。 -
依赖冲突:项目中可能存在与其他插件或库的依赖冲突,导致构建失败。检查
pubspec.yaml
文件中的依赖项,确保它们相互兼容。 -
配置问题:HarmonyOS项目的配置文件(如
build.gradle
)可能未正确设置,导致插件无法正确集成。确保所有必要的配置都已按照HarmonyOS开发指南进行设置。 -
环境问题:开发环境(如IDE、Flutter SDK、Dart SDK等)可能存在问题,导致插件无法正确构建。尝试更新环境至最新版本,并重启IDE。
针对上述问题,建议逐一排查并尝试解决。由于HarmonyOS平台相对较新,部分插件可能仍在适配中,因此也需关注插件的更新动态。如果问题依旧没法解决请联系官网客服,官网地址是:https://www.itying.com/category-93-b0.html