美文网首页
Flutter-Unhandled Exception: Mis

Flutter-Unhandled Exception: Mis

作者: 拿拿guardian | 来源:发表于2020-12-28 20:43 被阅读0次

卡了我一下午的问题,记录一下。
一、确保dart端和android端的MethodChannel名是一样的。
二、确保binding.binaryMessenger是唯一的
问题的根源在于我在demo的MainActivity的onCreate方法中,进行了多余的注册,生成了前后两binding.binaryMessenger:

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        GeneratedPluginRegistrant.registerWith(FlutterEngine(this))//这句不需要,因为FlutterActivityAndFragmentDelegate.onAttach方法会注册
    }

log里打印相关信息:

12-29 20:37:38.988 29552 29552 V wbj     : messenger = io.flutter.embedding.engine.dart.DartExecutor@492681c
12-29 20:37:38.988 29552 29552 V wbj     : binding.binaryMessenger = io.flutter.embedding.engine.dart.DartExecutor@8a5d87f
12-29 20:37:35.774 29552 29552 V wbj     : java.lang.Throwable
12-29 20:37:35.774 29552 29552 V wbj     :  at xxx.onAttachedToEngine(xxx.kt:42)
12-29 20:37:35.774 29552 29552 V wbj     :  at io.flutter.embedding.engine.FlutterEnginePluginRegistry.add(FlutterEnginePluginRegistry.java:133)
12-29 20:37:35.774 29552 29552 V wbj     :  at io.flutter.plugins.GeneratedPluginRegistrant.registerWith(GeneratedPluginRegistrant.java:17)
12-29 20:37:35.774 29552 29552 V wbj     :  at java.lang.reflect.Method.invoke(Native Method)
12-29 20:37:35.774 29552 29552 V wbj     :  at io.flutter.embedding.engine.plugins.util.GeneratedPluginRegister.registerGeneratedPlugins(GeneratedPluginRegister.java:34)
12-29 20:37:35.774 29552 29552 V wbj     :  at io.flutter.embedding.android.FlutterActivity.configureFlutterEngine(FlutterActivity.java:874)
12-29 20:37:35.774 29552 29552 V wbj     :  at io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.onAttach(FlutterActivityAndFragmentDelegate.java:181)
12-29 20:37:35.774 29552 29552 V wbj     :  at io.flutter.embedding.android.FlutterActivity.onCreate(FlutterActivity.java:410)
12-29 20:37:35.774 29552 29552 V wbj     :  at xxx.MainActivity.onCreate(MainActivity.kt:11)
12-29 20:37:35.774 29552 29552 V wbj     :  at android.app.Activity.performCreate(Activity.java:7802)
12-29 20:37:35.774 29552 29552 V wbj     :  at android.app.Activity.performCreate(Activity.java:7791)
12-29 20:37:35.774 29552 29552 V wbj     :  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1306)
12-29 20:37:35.774 29552 29552 V wbj     :  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3245)
12-29 20:37:35.774 29552 29552 V wbj     :  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3409)
12-29 20:37:35.774 29552 29552 V wbj     :  at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
12-29 20:37:35.774 29552 29552 V wbj     :  at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
12-29 20:37:35.774 29552 29552 V wbj     :  at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
12-29 20:37:35.774 29552 29552 V wbj     :  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2016)
12-29 20:37:35.774 29552 29552 V wbj     :  at android.os.Handler.dispatchMessage(Handler.java:107)
12-29 20:37:35.774 29552 29552 V wbj     :  at android.os.Looper.loop(Looper.java:214)
12-29 20:37:35.774 29552 29552 V wbj     :  at android.app.ActivityThread.main(ActivityThread.java:7356)
12-29 20:37:35.774 29552 29552 V wbj     :  at java.lang.reflect.Method.invoke(Native Method)
12-29 20:37:35.774 29552 29552 V wbj     :  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
12-29 20:37:35.774 29552 29552 V wbj     :  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
12-29 20:37:35.941 29552 29552 V wbj     : java.lang.Throwable
12-29 20:37:35.941 29552 29552 V wbj     :  at xxx.onAttachedToEngine(xxx.kt:42)
12-29 20:37:35.941 29552 29552 V wbj     :  at io.flutter.embedding.engine.FlutterEnginePluginRegistry.add(FlutterEnginePluginRegistry.java:133)
12-29 20:37:35.941 29552 29552 V wbj     :  at io.flutter.plugins.GeneratedPluginRegistrant.registerWith(GeneratedPluginRegistrant.java:17)
12-29 20:37:35.941 29552 29552 V wbj     :  at java.lang.reflect.Method.invoke(Native Method)
12-29 20:37:35.941 29552 29552 V wbj     :  at io.flutter.embedding.engine.FlutterEngine.registerPlugins(FlutterEngine.java:346)
12-29 20:37:35.941 29552 29552 V wbj     :  at io.flutter.embedding.engine.FlutterEngine.<init>(FlutterEngine.java:307)
12-29 20:37:35.941 29552 29552 V wbj     :  at io.flutter.embedding.engine.FlutterEngine.<init>(FlutterEngine.java:248)
12-29 20:37:35.941 29552 29552 V wbj     :  at io.flutter.embedding.engine.FlutterEngine.<init>(FlutterEngine.java:228)
12-29 20:37:35.941 29552 29552 V wbj     :  at io.flutter.embedding.engine.FlutterEngine.<init>(FlutterEngine.java:148)
12-29 20:37:35.941 29552 29552 V wbj     :  at io.flutter.embedding.engine.FlutterEngine.<init>(FlutterEngine.java:139)
12-29 20:37:35.941 29552 29552 V wbj     :  at xxx.MainActivity.onCreate(MainActivity.kt:13)
12-29 20:37:35.941 29552 29552 V wbj     :  at android.app.Activity.performCreate(Activity.java:7802)
12-29 20:37:35.941 29552 29552 V wbj     :  at android.app.Activity.performCreate(Activity.java:7791)
12-29 20:37:35.941 29552 29552 V wbj     :  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1306)
12-29 20:37:35.941 29552 29552 V wbj     :  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3245)
12-29 20:37:35.941 29552 29552 V wbj     :  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3409)
12-29 20:37:35.941 29552 29552 V wbj     :  at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
12-29 20:37:35.941 29552 29552 V wbj     :  at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
12-29 20:37:35.941 29552 29552 V wbj     :  at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
12-29 20:37:35.941 29552 29552 V wbj     :  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2016)
12-29 20:37:35.941 29552 29552 V wbj     :  at android.os.Handler.dispatchMessage(Handler.java:107)
12-29 20:37:35.941 29552 29552 V wbj     :  at android.os.Looper.loop(Looper.java:214)
12-29 20:37:35.941 29552 29552 V wbj     :  at android.app.ActivityThread.main(ActivityThread.java:7356)
12-29 20:37:35.941 29552 29552 V wbj     :  at java.lang.reflect.Method.invoke(Native Method)
12-29 20:37:35.941 29552 29552 V wbj     :  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
12-29 20:37:35.941 29552 29552 V wbj     :  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)

相关文章

  • Flutter-Unhandled Exception: Mis

    今天刚开始接触Flutter混合开发,在dart语言里调用android原生代码。这个错误卡了3个小时左右,尝试了...

  • Flutter-Unhandled Exception: Mis

    卡了我一下午的问题,记录一下。一、确保dart端和android端的MethodChannel名是一样的。二、确保...

  • mis

    自己喜欢什么样的人,或是想成为什么样的人,应该是你吧。 初中穿着校服还不高的你,带着眼镜被别人推搡的你,耍赖欠钱不...

  • MIS

  • MIS

    background 对于复杂函数的MC积分,可以使用重要性采样。如果采样函数的形状和被积函数类似,可以加快收敛速...

  • Mis vacaciones

    今天是九月一日 星期四 天有点阴 【仿佛为我要离开家去学校而悲伤呢】 今天是我本个暑假的倒数第五天 假期刚刚开始的...

  • MIS课程

    我们上了两个周末的MIS课程。 那本英语教材书几厘米厚,有的同学竟然购买了,天天背着上课。我觉得是比较沉的,直接在...

  • Azalea\Exception

    Exception 异常虚类 Azalea\Exception 继承于 PHP 异常类 \Exception Ex...

  • Frist Android

    Exception Exception: ActivityNotFoundException 启动browser 标签

  • 2017-6-1

    ◉ exception 和 import*○ exception1.exception 作为所有异常的父类,多了 ...

网友评论

      本文标题:Flutter-Unhandled Exception: Mis

      本文链接:https://www.haomeiwen.com/subject/rbpqoktx.html