HarmonyOS Flutter在pubspec.yaml添加webview_flutter后执行flutter pub get报错了

在pubspec.yaml文件中添加webview_flutter依赖项。

webview_flutter:
    git:
    url: "https://gitee.com/openharmony-sig/flutter_packages.git"
    path: "packages/webview_flutter/webview_flutter"

执行指令:

flutter build har --local-engine=/Users/rickli/Documents/Work/HM/12/src/out/ohos_release_arm64 --release 

输出报错log:

../../../.pub-cache/git/flutter_packages-420a4a8c2d71f83a77740b063f1d87a27e5c33ee/packages/webview_flutter/webview_flutter_ohos/lib/src/platform_views_service_proxy.dart:28:3: Error:
  Type 'ExpensiveOhosViewController' not found.
ExpensiveOhosViewController initExpensiveOhosView({
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  ../../../.pub-cache/git/flutter_packages-420a4a8c2d71f83a77740b063f1d87a27e5c33ee/packages/webview_flutter/webview_flutter_ohos/lib/src/platform_views_service_proxy.dart:47:3: Error:
  Type 'SurfaceOhosViewController' not found.
  SurfaceOhosViewController initSurfaceOhosView({
  ^^^^^^^^^^^^^^^^^^^^^^^^^
  ../../../.pub-cache/git/flutter_packages-420a4a8c2d71f83a77740b063f1d87a27e5c33ee/packages/webview_flutter/webview_flutter_ohos/lib/src/ohos_webview_controller.dart:1018:16: Error: The
  method 'OhosViewSurface' isn't defined for the class 'OhosWebViewWidget'.
  - 'OhosWebViewWidget' is from 'package:webview_flutter_ohos/src/ohos_webview_controller.dart'
  ('../../../.pub-cache/git/flutter_packages-420a4a8c2d71f83a77740b063f1d87a27e5c33ee/packages/webview_flutter/webview_flutter_ohos/lib/src/ohos_webview_controller.dart').
  Try correcting the name to the name of an existing method, or defining a method named 'OhosViewSurface'.
  return OhosViewSurface(
  ^^^^^^^^^^^^^^^
  ../../../.pub-cache/git/flutter_packages-420a4a8c2d71f83a77740b063f1d87a27e5c33ee/packages/webview_flutter/webview_flutter_ohos/lib/src/ohos_webview_controller.dart:1025:16: Error: A
  value of type 'OhosViewController' can't be returned from a function with return type 'PlatformViewController'.
  - 'OhosViewController' is from 'package:flutter/src/services/platform_views.dart' ('../../../fvm/versions/3.7.12-ohos/packages/flutter/lib/src/services/platform_views.dart').
  - 'PlatformViewController' is from 'package:flutter/src/services/platform_views.dart' ('../../../fvm/versions/3.7.12-ohos/packages/flutter/lib/src/services/platform_views.dart').
  return _initOhosView(
  ^
  ../../../.pub-cache/git/flutter_packages-420a4a8c2d71f83a77740b063f1d87a27e5c33ee/packages/webview_flutter/webview_flutter_ohos/lib/src/platform_views_service_proxy.dart:36:33: Error:
  Member not found: 'PlatformViewsService.initExpensiveOhosView'.
  return PlatformViewsService.initExpensiveOhosView(
  ^^^^^^^^^^^^^^^^^^^^^
  ../../../.pub-cache/git/flutter_packages-420a4a8c2d71f83a77740b063f1d87a27e5c33ee/packages/webview_flutter/webview_flutter_ohos/lib/src/platform_views_service_proxy.dart:55:33: Error:
  Member not found: 'PlatformViewsService.initSurfaceOhosView'.
  return PlatformViewsService.initSurfaceOhosView(
  ^^^^^^^^^^^^^^^^^^^
  Target kernel_snapshot failed: Exception
  #0      KernelSnapshot.build (package:flutter_tools/src/build_system/targets/common.dart:250:7)
  <asynchronous suspension>
  #1      _BuildInstance._invokeInternal (package:flutter_tools/src/build_system/build_system.dart:847:9)
  <asynchronous suspension>
  #2      Future.wait.<anonymous closure> (dart:async/future.dart:522:21)
  <asynchronous suspension>
  #3      _BuildInstance.invokeTarget (package:flutter_tools/src/build_system/build_system.dart:785:32)
  <asynchronous suspension>
  #4      Future.wait.<anonymous closure> (dart:async/future.dart:522:21)
  <asynchronous suspension>
  #5      _BuildInstance.invokeTarget (package:flutter_tools/src/build_system/build_system.dart:785:32)
  <asynchronous suspension>
  #6      FlutterBuildSystem.build (package:flutter_tools/src/build_system/build_system.dart:614:16)
  <asynchronous suspension>
  #7      flutterAssemble (package:flutter_tools/src/ohos/hvigor.dart:462:32)
  <asynchronous suspension>
  #8      OhosHvigorBuilder.flutterBuildPre (package:flutter_tools/src/ohos/hvigor.dart:753:27)
  <asynchronous suspension>
  #9      OhosHvigorBuilder.buildHar (package:flutter_tools/src/ohos/hvigor.dart:784:5)
  <asynchronous suspension>
  #10     BuildHarCommand.runCommand (package:flutter_tools/src/commands/build_har.dart:69:5)
  <asynchronous suspension>
  #11     FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1257:27)
  <asynchronous suspension>
  #12     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
  <asynchronous suspension>
  #13     CommandRunner.runCommand (package:args/command_runner.dart:209:13)
  <asynchronous suspension>
  #14     FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:283:9)
  <asynchronous suspension>
  #15     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
  <asynchronous suspension>
  #16     FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:229:5)
  <asynchronous suspension>
  #17     run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:64:9)
  <asynchronous suspension>
  #18     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
  <asynchronous suspension>
  #19     main (package:flutter_tools/executable.dart:91:3)
  <asynchronous suspension>
HarmonyOS
2天前
浏览
收藏 0
回答 1
待解决
回答 1
按赞同
/
按时间
zxjiu
分享
微博
QQ
微信
回复
1天前
相关问题
HarmonyOS webview_flutter报错
73浏览 • 1回复 待解决
Could not find a file named "pubspec.yaml"
413浏览 • 1回复 待解决
HarmonyOS webView_flutter保存
40浏览 • 1回复 待解决
HarmonyOS flutter webview如何调试
106浏览 • 1回复 待解决
flutter url_launcherHarmonyOS报错
37浏览 • 1回复 待解决
HarmonyOS 编译flutter报错
27浏览 • 1回复 待解决
HarmonyOS Flutter run指令报错
27浏览 • 1回复 待解决
HarmonyOS 创建Flutter demo运行报错
37浏览 • 1回复 待解决
HarmonyOS flutter plugin引用时git报错
38浏览 • 1回复 待解决
HarmonyOS 使用flutter创建packages时报错
36浏览 • 1回复 待解决