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
赞
收藏 0
回答 1
待解决
相关问题
HarmonyOS webview_flutter报错
73浏览 • 1回复 待解决
Could not find a file named "pubspec.yaml"
413浏览 • 1回复 待解决
HarmonyOS webView_flutter保存
40浏览 • 1回复 待解决
Flutter的插件webview_flutter,在HarmonyOS应用中,无法加载本地Html文件
629浏览 • 1回复 待解决
HarmonyOS Flutter:三方库webview_flutter无法下载到本地
32浏览 • 1回复 待解决
HarmonyOS环境下执行Flutter pub get一直卡住 "git clone --mirror https://gitee.com/openharmony-sig/flutter_packages.git
24浏览 • 1回复 待解决
HarmonyOS接入Flutter产物后,HarmonyOS与flutter交互报错
58浏览 • 1回复 待解决
webview_flutter demo 中顶部导航按钮无法响应事件
935浏览 • 1回复 待解决
HarmonyOS flutter webview如何调试
106浏览 • 1回复 待解决
HarmonyOS flutter在ohos如何添加系统回调
31浏览 • 1回复 待解决
flutter url_launcher在HarmonyOS报错
37浏览 • 1回复 待解决
HarmonyOS 编译flutter报错
27浏览 • 1回复 待解决
HarmonyOS Flutter run指令报错
27浏览 • 1回复 待解决
flutter已有的plugin如何添加HarmonyOS plugin?
244浏览 • 1回复 待解决
flutter项目flutter_inappwebview不支持HarmonyOS
43浏览 • 1回复 待解决
HarmonyOS 创建Flutter demo运行报错
37浏览 • 1回复 待解决
是否支持嵌入flutter项目,HarmonyOS和flutter混合开发
436浏览 • 1回复 待解决
HarmonyOS webview_flutter内嵌到弹窗视图或者滚动视图上时,位置偏移,且滚动联动有问题
40浏览 • 1回复 待解决
执行Flutter构建是提示The SDK license agreement is not accepted
456浏览 • 1回复 待解决
HarmonyOS flutter plugin引用时git报错
38浏览 • 1回复 待解决
HarmonyOS 使用flutter创建packages时报错
36浏览 • 1回复 待解决
HarmonyOS flutter_flutter开发环境搭建问题
28浏览 • 1回复 待解决
HarmonyOS Flutter webview 重定向后无法返回
143浏览 • 1回复 待解决
https://gitee.com/openharmony-sig/flutter_packages/blob/master/packages/webview_flutter-v4.4.4/webview_flutter/pubspec.yaml
参照这个试试,这边执行flutter pub get正常。