juliansteenbakker / mobile_scanner

A universal scanner for Flutter based on MLKit. Uses CameraX on Android and AVFoundation on iOS.
BSD 3-Clause "New" or "Revised" License
811 stars 472 forks source link

[Crash] In android, MissingPluginException(No implementation found for method torch on channel dev.steenbakker.mobile_scanner/scanner/method) #684

Open binhvtKova opened 1 year ago

binhvtKova commented 1 year ago

I'm using version mobile_scanner: ^3.3.0 in my project. When I run on Android real device, get crash when using torch method like below.

Non-fatal Exception: io.flutter.plugins.firebase.crashlytics.FlutterError: MissingPluginException(No implementation found for method torch on channel dev.steenbakker.mobile_scanner/scanner/method)
       at MethodChannel._invokeMethod(platform_channel.dart:313)
       at MobileScannerController.toggleTorch(mobile_scanner_controller.dart:280)

I've searched some helps and find this, maybe can help. https://stackoverflow.com/questions/70562128/unhandled-exception-missingpluginexceptionno-implementation-found-for-method-s

Please help me to make a fix for this. Thanks

navaronbracke commented 10 months ago

@binhvtKova Does this reproduce on version 3.5.1 ? We no longer use a FlutterFragmentActivity.

jokerknight commented 7 months ago

MissingPluginException(No implementation found for method listen on channel dev.steenbakker.mobile_scanner/scanner/event) same error, almost blocked to use. if you can't resolve this issue just publish a worked version to flutter plugin market?

navaronbracke commented 7 months ago

Does this reproduce on the example app with version 3.5.6 ?

You might need to update your dependencies (including your Flutter version) using flutter clean && flutter pub get

navaronbracke commented 6 months ago

@binhvtKova Is this still occurring on version 4.0.1 or the new beta, 5.0.0-beta.1 ? We did include a proguard file on Android for release builds. We also don't require a FlutterFragmentActivity. You might need to do flutter clean and flutter pub get, due to needing to update your GeneratedPluginRegistrant that is generated by Flutter.

Kancheraj commented 5 months ago

flutter: MissingPluginException(No implementation found for method listen on channel dev.steenbakker.mobile_scanner/scanner/event) flutter: #0 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:332) flutter: flutter: #1 EventChannel.receiveBroadcastStream. (package:flutter/src/services/platform_channel.dart:676) flutter:

yes its occurring in version mobile_scanner: ^4.0.1 , please help me

navaronbracke commented 5 months ago

Could you provide a minimal reproducible sample? This sounds like you're forgetting to call WidgetsFlutterBinding.ensureInitialized(); before using the plugin.

Some additional questions: 1) Are you running in release mode? 2) Could you provide your pubspec.lock file? 3) Did you run flutter clean && flutter pub get

Kancheraj commented 5 months ago

Yes I’m running in release mode to test in real iPhone device, may be this is issue related to camera permission.im using permission_handler packager for handling the permission.

In initstate I’m calling these method to get camera permission. WidgetsFlutterBinding.ensureInitialized(); bloc.add(CheckPermissionEvent(context)); on builder widget MobileScanner( errorBuilder: (context, error, child) { return ScannerErrorWidget(error: error); }, onDetect: (capture) { final List barcodes = capture.barcodes; for (final barcode in barcodes) { print('Barcode found! ${barcode.rawValue}'); } }, ),

Note : if I don’t use the permission_handler it will work fine.

Internal

From: Navaron Bracke @.> Date: Monday, 25 March 2024 at 12:39 PM To: juliansteenbakker/mobile_scanner @.> Cc: Kanche Rajkumar @.>, Comment @.> Subject: [Ext] Re: [juliansteenbakker/mobile_scanner] [Crash] In android, MissingPluginException(No implementation found for method torch on channel dev.steenbakker.mobile_scanner/scanner/method) (Issue #684) CAUTION: This email originated from outside of the organisation. Do not click links or open attachments unless you recognise the sender and know the content is safe.

Could you provide a minimal reproducible sample? This sounds like you're forgetting to call WidgetsFlutterBinding.ensureInitialized(); before using the plugin.

Some additional questions:

  1. Are you running in release mode?
  2. Could you provide your pubspec.lock file?
  3. Did you run flutter clean && flutter pub get

— Reply to this email directly, view it on GitHubhttps://github.com/juliansteenbakker/mobile_scanner/issues/684#issuecomment-2017357990, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A74K4M73KLHNMGRFCQSB4I3YZ7EUHAVCNFSM6AAAAAA2BG6OL2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMJXGM2TOOJZGA. You are receiving this because you commented.Message ID: @.***>