You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Flutter升级至3.29后ffmpeg_kit_flutter_full_gpl-6.0.3报Registrar错误求替代方案

Flutter 3.29升级后ffmpeg_kit_flutter_full_gpl编译错误及替代方案

问题背景

在Flutter 3.27版本中使用ffmpeg_kit_flutter_full_gpl: 6.0.3,升级到Flutter 3.29后Android端出现PluginRegistry.Registrar相关编译错误,该版本库已17个月未更新,需要可替代的解决方案。

错误日志

/Users/pamcd/.pub-cache/hosted/pub.dev/ffmpeg_kit_flutter_full_gpl-6.0.3/android/src/main/java/com/arthenica/ffmpegkit/flutter/FFmpegKitFlutterPlugin.java:157: error: cannot find symbol
    public static void registerWith(final io.flutter.plugin.common.PluginRegistry.Registrar registrar) {
                                                                                 ^
  symbol:   class Registrar
  location: interface PluginRegistry
/Users/pamcd/.pub-cache/hosted/pub.dev/ffmpeg_kit_flutter_full_gpl-6.0.3/android/src/main/java/com/arthenica/ffmpegkit/flutter/FFmpegKitFlutterPlugin.java:651: error: cannot find symbol
    protected void init(final BinaryMessenger messenger, final Context context, final Activity activity, final io.flutter.plugin.common.PluginRegistry.Registrar registrar, final ActivityPluginBinding activityBinding) {
                                                                                                                                                ^
  symbol:   class Registrar
  location: interface PluginRegistry
2 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':ffmpeg_kit_flutter_full_gpl:compileReleaseJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* Try:
> Run with --info option to get more log output.
> Run with --scan to get full insights.

解决方案

1. 升级到FFmpeg Kit官方最新版本

ffmpeg_kit_flutter_full_gpl的官方仓库已更新到支持Flutter新插件API的版本,直接升级即可解决Registrar兼容问题。修改pubspec.yaml中的依赖:

ffmpeg_kit_flutter_full_gpl: ^6.1.0

新版本适配了Flutter 3.10+的插件注册标准,移除了对PluginRegistry.Registrar的依赖,完全兼容Flutter 3.29。

2. 切换社区维护的替代库

如果官方版本仍有适配问题,可以选择社区维护的FFmpeg Flutter插件,这类分支通常会跟进Flutter的版本迭代,保证兼容性。

3. 临时修改插件源码(不推荐)

若暂时无法升级依赖,可手动修改本地缓存的插件代码应急:

  • 打开路径/Users/pamcd/.pub-cache/hosted/pub.dev/ffmpeg_kit_flutter_full_gpl-6.0.3/android/src/main/java/com/arthenica/ffmpegkit/flutter/FFmpegKitFlutterPlugin.java
  • 删除所有涉及PluginRegistry.Registrar的方法和参数,改用FlutterPlugin和ActivityAware接口实现插件注册
    注意:此方法仅作临时修复,后续依赖更新会覆盖修改,长期使用存在维护风险。

内容的提问来源于stack exchange,提问作者Lisa

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.13 21:32:45