<img width="1284" height="892" alt="Image" src="https://github.com/user-attachments/assets/9662f389-c8b3-4e6a-be29-3c41fafde939" /> <img width="1596" height="554" alt="Image" src="https://github.com/user-attachments/assets/2781982d-3541-4009-b38e-8b8e73b7375e" /> FlutterEngine 的automaticallyRegisterPlugins为true,在FlutterEngine构造方法中会自动调用GeneratedPluginRegistrant.registerWith, 从而将所有plugin都注册到这个FlutterEngine下,FlutterEngine.destroy时会将调用plugin的onDetachedFromEngine方法,这样会影响到一些单例plugin出现异常;例如jpush_flutter
Activity
qxb568 commentedon Jul 28, 2025
我也碰到了这个问题,有没有什么好的解决办法啊
saicheng commentedon Jul 28, 2025
将ForegroundTask的init中创建FlutterEngine(context), 改为FlutterEngine(context, null, false)
lwy121810 commentedon Oct 13, 2025
怎么修复啊?FlutterForegroundTask.init方法里没有FlutterEngine(context)参数啊? flutter_foreground_task: ^9.1.0,
saicheng commentedon Mar 31, 2026
你都搜错文件了,ForegroundTask.kt这个