Flutter MissingPluginException错误

时间:2018-05-20 00:01:31

标签: flutter

我正试图通过Android Studio中的Flutter在我的S7 Edge(Android 7)上运行QR码阅读器应用程序。

以下是示例代码的链接:https://pub.dartlang.org/packages/qrcode_reader#-example-tab-

当我运行应用程序时,它显示在我的手机上但是如果我点击按钮它会给我这个输出(包括我试图多次点击扫描按钮无效):

请阅读以下编辑

E/flutter (31215): [ERROR:topaz/lib/tonic/logging/dart_error.cc(16)] Unhandled exception:
E/flutter (31215): MissingPluginException(No implementation found for method readQRCode on channel qrcode_reader)
E/flutter (31215): #0      MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:278:7)
E/flutter (31215): <asynchronous suspension>
E/flutter (31215): #1      QRCodeReader.scan (package:qrcode_reader/QRCodeReader.dart:67:27)
E/flutter (31215): <asynchronous suspension>
E/flutter (31215): #2      _MyHomePageState.build.<anonymous closure>.<anonymous closure> (file:///C:/Users/x/AndroidStudioProjects/qr_cod
E/lib/main.dart:56:10)
E/flutter (31215): #3      State.setState (package:flutter/src/widgets/framework.dart:1117:30)
E/flutter (31215): #4      _MyHomePageState.build.<anonymous closure> (file:///C:/Users/x/AndroidStudioProjects/qr_cod
E/lib/main.dart:49:6)
E/flutter (31215): #5      _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:494:14)
E/flutter (31215): #6      _InkResponseState.build.<anonymous closure> (package:flutter/src/material/ink_well.dart:549:30)
E/flutter (31215): #7      GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:102:24)
E/flutter (31215): #8      TapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:161:9)
E/flutter (31215): #9      TapGestureRecognizer.handlePrimaryPointer (package:flutter/src/gestures/tap.dart:94:7)
E/flutter (31215): #10     PrimaryPointerGestureRecognizer.handleEvent (package:flutter/src/gestures/recognizer.dart:315:9)
E/flutter (31215): #11     PointerRouter._dispatch (package:flutter/src/gestures/pointer_router.dart:73:12)
E/flutter (31215): #12     PointerRouter.route (package:flutter/src/gestures/pointer_router.dart:101:11)
E/flutter (31215): #13     _WidgetsFlutterBinding&BindingBase&GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:143:19)
E/flutter (31215): #14     _WidgetsFlutterBinding&BindingBase&GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:121:22)
E/flutter (31215): #15     _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerEvent (package:flutter/src/gestures/binding.dart:101:7)
E/flutter (31215): #16     _WidgetsFlutterBinding&BindingBase&GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:64:7)
E/flutter (31215): #17     _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:48:7)
E/flutter (31215): #18     _invoke1 (dart:ui/hooks.dart:134:13)
E/flutter (31215): #19     _dispatchPointerDataPacket (dart:ui/hooks.dart:91:5)
D/ViewRootImpl@526fccd[MainActivity](31215): ViewPostImeInputStage processPointer 0
D/ViewRootImpl@526fccd[MainActivity](31215): ViewPostImeInputStage processPointer 1
E/flutter (31215): [ERROR:topaz/lib/tonic/logging/dart_error.cc(16)] Unhandled exception:
E/flutter (31215): MissingPluginException(No implementation found for method readQRCode on channel qrcode_reader)
E/flutter (31215): #0      MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:278:7)
E/flutter (31215): <asynchronous suspension>
E/flutter (31215): #1      QRCodeReader.scan (package:qrcode_reader/QRCodeReader.dart:67:27)
E/flutter (31215): <asynchronous suspension>
E/flutter (31215): #2      _MyHomePageState.build.<anonymous closure>.<anonymous closure> (file:///C:/Users/x/AndroidStudioProjects/qr_cod
E/lib/main.dart:56:10)
E/flutter (31215): #3      State.setState (package:flutter/src/widgets/framework.dart:1117:30)
E/flutter (31215): #4      _MyHomePageState.build.<anonymous closure> (file:///C:/Users/x/AndroidStudioProjects/qr_cod
E/lib/main.dart:49:6)
E/flutter (31215): #5      _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:494:14)
E/flutter (31215): #6      _InkResponseState.build.<anonymous closure> (package:flutter/src/material/ink_well.dart:549:30)
E/flutter (31215): #7      GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:102:24)
E/flutter (31215): #8      TapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:161:9)
E/flutter (31215): #9      TapGestureRecognizer.handlePrimaryPointer (package:flutter/src/gestures/tap.dart:94:7)
E/flutter (31215): #10     PrimaryPointerGestureRecognizer.handleEvent (package:flutter/src/gestures/recognizer.dart:315:9)
E/flutter (31215): #11     PointerRouter._dispatch (package:flutter/src/gestures/pointer_router.dart:73:12)
E/flutter (31215): #12     PointerRouter.route (package:flutter/src/gestures/pointer_router.dart:101:11)
E/flutter (31215): #13     _WidgetsFlutterBinding&BindingBase&GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:143:19)
E/flutter (31215): #14     _WidgetsFlutterBinding&BindingBase&GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:121:22)
E/flutter (31215): #15     _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerEvent (package:flutter/src/gestures/binding.dart:101:7)
E/flutter (31215): #16     _WidgetsFlutterBinding&BindingBase&GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:64:7)
E/flutter (31215): #17     _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:48:7)
E/flutter (31215): #18     _invoke1 (dart:ui/hooks.dart:134:13)
E/flutter (31215): #19     _dispatchPointerDataPacket (dart:ui/hooks.dart:91:5)
D/ViewRootImpl@526fccd[MainActivity](31215): ViewPostImeInputStage processPointer 0
D/ViewRootImpl@526fccd[MainActivity](31215): ViewPostImeInputStage processPointer 1
E/flutter (31215): [ERROR:topaz/lib/tonic/logging/dart_error.cc(16)] Unhandled exception:
E/flutter (31215): MissingPluginException(No implementation found for method readQRCode on channel qrcode_reader)
E/flutter (31215): #0      MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:278:7)
E/flutter (31215): <asynchronous suspension>
E/flutter (31215): #1      QRCodeReader.scan (package:qrcode_reader/QRCodeReader.dart:67:27)
E/flutter (31215): <asynchronous suspension>
E/flutter (31215): #2      _MyHomePageState.build.<anonymous closure>.<anonymous closure> (file:///C:/Users/x/AndroidStudioProjects/qr_cod
E/lib/main.dart:56:10)
E/flutter (31215): #3      State.setState (package:flutter/src/widgets/framework.dart:1117:30)
E/flutter (31215): #4      _MyHomePageState.build.<anonymous closure> (file:///C:/Users/x/AndroidStudioProjects/qr_cod
E/lib/main.dart:49:6)
E/flutter (31215): #5      _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:494:14)
E/flutter (31215): #6      _InkResponseState.build.<anonymous closure> (package:flutter/src/material/ink_well.dart:549:30)
E/flutter (31215): #7      GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:102:24)
E/flutter (31215): #8      TapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:161:9)
E/flutter (31215): #9      TapGestureRecognizer.acceptGesture (package:flutter/src/gestures/tap.dart:123:7)
E/flutter (31215): #10     GestureArenaManager.sweep (package:flutter/src/gestures/arena.dart:156:27)
E/flutter (31215): #11     _WidgetsFlutterBinding&BindingBase&GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:147:20)
E/flutter (31215): #12     _WidgetsFlutterBinding&BindingBase&GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:121:22)
E/flutter (31215): #13     _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerEvent (package:flutter/src/gestures/binding.dart:101:7)
E/flutter (31215): #14     _WidgetsFlutterBinding&BindingBase&GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:64:7)
E/flutter (31215): #15     _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:48:7)
E/flutter (31215): #16     _invoke1 (dart:ui/hooks.dart:134:13)
E/flutter (31215): #17     _dispatchPointerDataPacket (dart:ui/hooks.dart:91:5)
D/ViewRootImpl@526fccd[MainActivity](31215): ViewPostImeInputStage processPointer 0
D/ViewRootImpl@526fccd[MainActivity](31215): ViewPostImeInputStage processPointer 1
E/flutter (31215): [ERROR:topaz/lib/tonic/logging/dart_error.cc(16)] Unhandled exception:
E/flutter (31215): MissingPluginException(No implementation found for method readQRCode on channel qrcode_reader)
E/flutter (31215): #0      MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:278:7)
E/flutter (31215): <asynchronous suspension>
E/flutter (31215): #1      QRCodeReader.scan (package:qrcode_reader/QRCodeReader.dart:67:27)
E/flutter (31215): <asynchronous suspension>
E/flutter (31215): #2      _MyHomePageState.build.<anonymous closure>.<anonymous closure> (file:///C:/Users/x/AndroidStudioProjects/qr_cod
E/lib/main.dart:56:10)
E/flutter (31215): #3      State.setState (package:flutter/src/widgets/framework.dart:1117:30)
E/flutter (31215): #4      _MyHomePageState.build.<anonymous closure> (file:///C:/Users/x/AndroidStudioProjects/qr_cod
E/lib/main.dart:49:6)
E/flutter (31215): #5      _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:494:14)
E/flutter (31215): #6      _InkResponseState.build.<anonymous closure> (package:flutter/src/material/ink_well.dart:549:30)
E/flutter (31215): #7      GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:102:24)
E/flutter (31215): #8      TapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:161:9)
E/flutter (31215): #9      TapGestureRecognizer.acceptGesture (package:flutter/src/gestures/tap.dart:123:7)
E/flutter (31215): #10     GestureArenaManager.sweep (package:flutter/src/gestures/arena.dart:156:27)
E/flutter (31215): #11     _WidgetsFlutterBinding&BindingBase&GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:147:20)
E/flutter (31215): #12     _WidgetsFlutterBinding&BindingBase&GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:121:22)
E/flutter (31215): #13     _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerEvent (package:flutter/src/gestures/binding.dart:101:7)
E/flutter (31215): #14     _WidgetsFlutterBinding&BindingBase&GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:64:7)
E/flutter (31215): #15     _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:48:7)
E/flutter (31215): #16     _invoke1 (dart:ui/hooks.dart:134:13)
E/flutter (31215): #17     _dispatchPointerDataPacket (dart:ui/hooks.dart:91:5)
D/ViewRootImpl@526fccd[MainActivity](31215): ViewPostImeInputStage processPointer 0
D/ViewRootImpl@526fccd[MainActivity](31215): ViewPostImeInputStage processPointer 1
D/ViewRootImpl@526fccd[MainActivity](31215): ViewPostImeInputStage processPointer 0
D/ViewRootImpl@526fccd[MainActivity](31215): ViewPostImeInputStage processPointer 1
D/ViewRootImpl@526fccd[MainActivity](31215): ViewPostImeInputStage processPointer 0
D/ViewRootImpl@526fccd[MainActivity](31215): ViewPostImeInputStage processPointer 1
E/flutter (31215): [ERROR:topaz/lib/tonic/logging/dart_error.cc(16)] Unhandled exception:
E/flutter (31215): MissingPluginException(No implementation found for method readQRCode on channel qrcode_reader)
E/flutter (31215): #0      MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:278:7)
E/flutter (31215): <asynchronous suspension>
E/flutter (31215): #1      QRCodeReader.scan (package:qrcode_reader/QRCodeReader.dart:67:27)
E/flutter (31215): <asynchronous suspension>
E/flutter (31215): #2      _MyHomePageState.build.<anonymous closure>.<anonymous closure> (file:///C:/Users/x/AndroidStudioProjects/qr_cod
E/lib/main.dart:56:10)
E/flutter (31215): #3      State.setState (package:flutter/src/widgets/framework.dart:1117:30)
E/flutter (31215): #4      _MyHomePageState.build.<anonymous closure> (file:///C:/Users/x/AndroidStudioProjects/qr_cod
E/lib/main.dart:49:6)
E/flutter (31215): #5      _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:494:14)
E/flutter (31215): #6      _InkResponseState.build.<anonymous closure> (package:flutter/src/material/ink_well.dart:549:30)
E/flutter (31215): #7      GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:102:24)
E/flutter (31215): #8      TapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:161:9)
E/flutter (31215): #9      TapGestureRecognizer.acceptGesture (package:flutter/src/gestures/tap.dart:123:7)
E/flutter (31215): #10     GestureArenaManager.sweep (package:flutter/src/gestures/arena.dart:156:27)
E/flutter (31215): #11     _WidgetsFlutterBinding&BindingBase&GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:147:20)
E/flutter (31215): #12     _WidgetsFlutterBinding&BindingBase&GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:121:22)
E/flutter (31215): #13     _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerEvent (package:flutter/src/gestures/binding.dart:101:7)
E/flutter (31215): #14     _WidgetsFlutterBinding&BindingBase&GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:64:7)
E/flutter (31215): #15     _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:48:7)
E/flutter (31215): #16     _invoke1 (dart:ui/hooks.dart:134:13)
E/flutter (31215): #17     _dispatchPointerDataPacket (dart:ui/hooks.dart:91:5)

编辑:

我重新启动计算机以查看是否存在问题,因为我刚刚在此计算机上安装了Android Studio。现在每当我运行项目时,我都会收到此错误

C:\Users\x\Documents\Coding\Flutter\SDK\flutter\.pub-cache\hosted\pub.dartlang.org\qrcode_reader-0.3.3\android\src\main\java\com\matheusvillela\flutter\plugins\qrcodereader\QRCodeReaderPlugin.java:42: error: cannot find symbol public class QRCodeReaderPlugin implements MethodCallHandler, ActivityResultListener, PluginRegistry.RequestPermissionResultListener {
                                                                                                    ^   symbol:   class RequestPermissionResultListener   location: interface PluginRegistry C:\Users\x\Documents\Coding\Flutter\SDK\flutter\.pub-cache\hosted\pub.dartlang.org\qrcode_reader-0.3.3\android\src\main\java\com\matheusvillela\flutter\plugins\qrcodereader\QRCodeReaderPlugin.java:63: error: incompatible types: QRCodeReaderPlugin cannot be converted to RequestPermissionsResultListener
            registrar.addRequestPermissionsResultListener(instance);
                                                          ^ C:\Users\x\Documents\Coding\Flutter\SDK\flutter\.pub-cache\hosted\pub.dartlang.org\qrcode_reader-0.3.3\android\src\main\java\com\matheusvillela\flutter\plugins\qrcodereader\QRCodeReaderPlugin.java:155: error: method does not override or implement a method from a supertype
    @Override
    ^ Note: C:\Users\x\Documents\Coding\Flutter\SDK\flutter\.pub-cache\hosted\pub.dartlang.org\qrcode_reader-0.3.3\android\src\main\java\com\matheusvillela\flutter\plugins\qrcodereader\QRCodeReaderPlugin.java uses unchecked or unsafe operations. Note: Recompile with
-Xlint:unchecked for details. Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output 3 errors

FAILURE: Build failed with an exception.

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

* Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

* Get more help at https://help.gradle.org

BUILD FAILED in 2s Finished with error: Gradle build failed: 1

1 个答案:

答案 0 :(得分:0)

pubspec.yaml文件中添加插件语句后,您需要执行flutter packages get命令。

此外,您还可以先尝试flutter upgrade。然后检查你的颤动医生输出。

有时,我也会切换Flutter通道,因为有bug。通过Flutter channel XXX XXX devmasterbeta发布{{1}}来更改Flutter频道。