The plugin flutter_webview_plugin uses a deprecated version of the Android embedding错误

时间:2022-10-12 19:00:45

问题描述

今天在学习别人代码的时候遇到了一个编译报错,报错如下:

The plugin flutter_webview_plugin uses a deprecated version of the Android embedding.
To avoid unexpected runtime failures, or future build failures, try to see if this plugin supports the Android V2 embedding. Otherwise, consider removing it since a future release of Flutter will remove these deprecated APIs.
If you are plugin author, take a look at the docs for migrating the plugin to the V2 embedding: https://flutter.dev/go/android-plugin-migration.

如下图:

The plugin flutter_webview_plugin uses a deprecated version of the Android embedding错误

原因分析

flutter_webview_plugin 使用了Android被抛弃了的版本,为了防止程序运行时出错,不然使用这个插件。

解决办法:

换成其他插件。这里我是使用的flutter_webview_plugin插件,这个插件已经没有人维护了,使用 webview_flutter来代替。

更改pubspec.yaml中的插件配置 The plugin flutter_webview_plugin uses a deprecated version of the Android embedding错误