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

本文解决了Flutter应用中因使用过时的flutter_webview_plugin插件导致的编译错误问题,建议替换为webview_flutter。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

问题描述

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

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.

如下图:
在这里插入图片描述

原因分析

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

解决办法:

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

更改pubspec.yaml中的插件配置

在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值