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
871 stars 508 forks source link

Another exception was thrown: PlatformException(error, No active stream to cancel, null, null) #636

Open gslovemy opened 1 year ago

gslovemy commented 1 year ago

[ ] Reloaded 31 of 2804 libraries in 1,298ms (compile: 607 ms, reload: 497 ms, reassemble: 103 ms). [+3221 ms] ══╡ EXCEPTION CAUGHT BY SERVICES LIBRARY ╞══════════════════════════════════════════════════════════ The following PlatformException was thrown while de-activating platform stream on channel dev.steenbakker.mobile_scanner/scanner/event: PlatformException(error, No active stream to cancel, null, null)

                When the exception was thrown, this was the stack:
                #0      StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:653:7)
                #1      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:296:18)
                <asynchronous suspension>
                #2      EventChannel.receiveBroadcastStream.<anonymous closure>

(package:flutter/src/services/platform_channel.dart:649:9)

════════════════════════════════════════════════════════════════════════════════════════════════════ [+4200 ms] Another exception was thrown: PlatformException(error, No active stream to cancel, null, null) Flutter version 3.3.9 moblie_scan 3.2.0
tologonkudaiberdiuulu commented 1 year ago

Any progress on this issue?

varsik-eucalyptus commented 1 year ago

I am gearing the same issue. Any progress on this?

emrahkenan commented 1 year ago

I am having the same issue.

flutter version: 3.10.5 mobile scanner: 3.2.0

firebase crash event

flutter_error_exception PlatformException(error, No active stream to cancel, null, null)
flutter_error_reason    thrown while de-activating platform stream on channel dev.steenbakker.mobile_scanner/scanner/event

Stack trace

    Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'android.hardware.camera2.CaptureRequest android.hardware.camera2.impl.CameraDeviceImpl$CaptureCallbackHolder.getRequest(int)' on a null object reference
       at android.hardware.camera2.impl.CameraDeviceImpl$CameraDeviceCallbacks.onResultReceived(CameraDeviceImpl.java:2172)
       at android.hardware.camera2.legacy.CameraDeviceUserShim$CameraCallbackThread$CallbackHandler.handleMessage(CameraDeviceUserShim.java:327)
       at android.os.Handler.dispatchMessage(Handler.java:107)
       at android.os.Looper.loop(Looper.java:237)
       at android.os.HandlerThread.run(HandlerThread.java:67)
artemsorochan commented 1 year ago

Same issue

cody1024d commented 1 year ago

I'm seeing this issue as well. I'd like to also include some further research I did, that may help provide more context.

The exception that @emrahkenan posted: Google Issue That Describes Same Exception

The google dev here specifically recommends:

When invoking SurfaceRequest.provideSurface(surface, executor, Consumer) , the Consumer will get notified that the surface is safe to be released.

Could it be that we're not releasing the surface (or the underlying texture) at the right time?

Either way I think some additional logging within that callback may help further debug this issue, as there are several results that may be provided, which further describe any errors that occur when binding the surface to the request.

provideSurface result constants

michael-joseph-payne commented 1 year ago

same issue....completely screws up repeat scans

ozkayas commented 2 months ago

Any news? Having same issue with mobile_scanner: 3.5.5 Is this fixed with the latest version 5.0.0 ??