rmtmckenzie / flutter_qr_mobile_vision

QR reader plugin using mobile vision API for Flutter.
MIT License
217 stars 186 forks source link

Cannot scan code with an Exception, same error in SAMSUNG S22U and Emulator API 31 #208

Closed RightFS closed 1 year ago

RightFS commented 2 years ago
I/cgr.qrmv.QrReader( 9772): Using new camera API.
D/TransportRuntime.JobInfoScheduler( 9772): Scheduling upload for context TransportContext(cct, DEFAULT, MSRodHRwczovL2ZpcmViYXNlbG9nZ2luZy5nb29nbGVhcGlzLmNvbS92MGNjL2xvZy9iYXRjaD9mb3JtYXQ9anNvbl9wcm90bzNc) with jobId=1733829336 in 30000ms(Backend next call timestamp 0). Attempt 1
D/TransportRuntime.JobInfoScheduler( 9772): Scheduling upload for context TransportContext(cct, VERY_LOW, MSRodHRwczovL2ZpcmViYXNlbG9nZ2luZy5nb29nbGVhcGlzLmNvbS92MGNjL2xvZy9iYXRjaD9mb3JtYXQ9anNvbl9wcm90bzNc) with jobId=1738810073 in 86400000ms(Backend next call timestamp 0). Attempt 1
I/CameraManagerGlobal( 9772): Connecting to camera service
I/DynamiteModule( 9772): Considering local module com.google.mlkit.dynamite.barcode:10000 and remote module com.google.mlkit.dynamite.barcode:0
I/DynamiteModule( 9772): Selected local version of com.google.mlkit.dynamite.barcode
D/VendorTagDescriptor( 9772): addVendorDescriptor: vendor tag id 14172875900359437128 added
I/CameraManagerGlobal( 9772): Camera 0 facing CAMERA_FACING_BACK state now CAMERA_STATE_CLOSED for client com.szwlcc.app API Level 2
I/CameraManagerGlobal( 9772): Camera 1 facing CAMERA_FACING_FRONT state now CAMERA_STATE_CLOSED for client com.samsung.android.smartface API Level 2
I/CameraManagerGlobal( 9772): Camera 2 facing CAMERA_FACING_BACK state now CAMERA_STATE_CLOSED for client android.system API Level 2
I/CameraManagerGlobal( 9772): Camera 20 facing CAMERA_FACING_BACK state now CAMERA_STATE_CLOSED for client com.sec.android.app.camera API Level 2
I/CameraManagerGlobal( 9772): Camera 21 facing CAMERA_FACING_BACK state now CAMERA_STATE_CLOSED for client android.system API Level 2
I/CameraManagerGlobal( 9772): Camera 23 facing CAMERA_FACING_BACK state now CAMERA_STATE_CLOSED for client android.system API Level 2
I/CameraManagerGlobal( 9772): Camera 3 facing CAMERA_FACING_FRONT state now CAMERA_STATE_CLOSED for client android.system API Level 2
I/CameraManagerGlobal( 9772): Camera 4 facing CAMERA_FACING_FRONT state now CAMERA_STATE_CLOSED for client vendor.client.pid<1830> API Level 2
I/CameraManagerGlobal( 9772): Camera 52 facing CAMERA_FACING_BACK state now CAMERA_STATE_CLOSED for client com.samsung.android.scan3d API Level 2
I/CameraManagerGlobal( 9772): Camera 54 facing CAMERA_FACING_BACK state now CAMERA_STATE_CLOSED for client com.sec.android.app.camera API Level 2
I/CameraManagerGlobal( 9772): Camera 56 facing CAMERA_FACING_BACK state now CAMERA_STATE_CLOSED for client com.sec.android.app.camera API Level 2
I/CameraManagerGlobal( 9772): Camera 58 facing CAMERA_FACING_BACK state now CAMERA_STATE_CLOSED for client com.sec.android.app.camera API Level 2
I/CameraManagerGlobal( 9772): Camera 90 facing CAMERA_FACING_FRONT state now CAMERA_STATE_CLOSED for client android.system API Level 2
I/cgr.qrmv.QrCameraC2( 9772): Device target size: 1050x1050
I/cgr.qrmv.QrCameraC2( 9772): Camera sensor flipped: true
I/cgr.qrmv.QrCameraC2( 9772): Set preview size: 1088x1088
I/cgr.qrmv.QrCameraC2( 9772): Set camera size: 1088x1088
D/TransportRuntime.SQLiteEventStore( 9772): Storing event with priority=DEFAULT, name=FIREBASE_ML_SDK for destination cct
D/TransportRuntime.JobInfoScheduler( 9772): Upload for context TransportContext(cct, DEFAULT, MSRodHRwczovL2ZpcmViYXNlbG9nZ2luZy5nb29nbGVhcGlzLmNvbS92MGNjL2xvZy9iYXRjaD9mb3JtYXQ9anNvbl9wcm90bzNc) is already scheduled. Returning...
D/TransportRuntime.SQLiteEventStore( 9772): Storing event with priority=VERY_LOW, name=FIREBASE_ML_SDK for destination cct
D/TransportRuntime.JobInfoScheduler( 9772): Upload for context TransportContext(cct, VERY_LOW, MSRodHRwczovL2ZpcmViYXNlbG9nZ2luZy5nb29nbGVhcGlzLmNvbS92MGNjL2xvZy9iYXRjaD9mb3JtYXQ9anNvbl9wcm90bzNc) is already scheduled. Returning...
I/cgr.qrmv.QrCameraC2( 9772): Setting af mode to: 3
I/CameraManagerGlobal( 9772): Camera 0 facing CAMERA_FACING_BACK state now CAMERA_STATE_OPEN for client com.szwlcc.app API Level 2
I/NDOP    ( 9772): listening using window listener
I/CameraManagerGlobal( 9772): Camera 0 facing CAMERA_FACING_BACK state now CAMERA_STATE_ACTIVE for client com.szwlcc.app API Level 2
I/BufferQueueProducer( 9772): [ImageReader-1088x1088f23m5-9772-0](id:262c00000003,api:4,p:1701,c:9772) queueBuffer: queued for the first time.
I/BufferQueueProducer( 9772): [SurfaceTexture-0-9772-0](id:262c00000002,api:4,p:1701,c:9772) queueBuffer: queued for the first time.
D/TransportRuntime.SQLiteEventStore( 9772): Storing event with priority=VERY_LOW, name=FIREBASE_ML_SDK for destination cct
D/TransportRuntime.JobInfoScheduler( 9772): Upload for context TransportContext(cct, VERY_LOW, MSRodHRwczovL2ZpcmViYXNlbG9nZ2luZy5nb29nbGVhcGlzLmNvbS92MGNjL2xvZy9iYXRjaD9mb3JtYXQ9anNvbl9wcm90bzNc) is already scheduled. Returning...
I/tflite  ( 9772): Initialized TensorFlow Lite runtime.
I/native  ( 9772): I1014 23:16:31.854976   10030 oned_decoder_client.cc:685] barhopper::deep_learning::OnedDecoderClient is created successfully.
W/cgr.qrmv.QrDetector( 9772): Barcode Reading Failure: 
W/cgr.qrmv.QrDetector( 9772): com.google.mlkit.common.MlKitException: Internal error has occurred when executing ML Kit tasks
W/cgr.qrmv.QrDetector( 9772):   at com.google.mlkit.common.sdkinternal.ModelResource.zza(com.google.mlkit:common@@18.0.0:9)
W/cgr.qrmv.QrDetector( 9772):   at com.google.mlkit.common.sdkinternal.zzl.run(Unknown Source:10)
W/cgr.qrmv.QrDetector( 9772):   at com.google.mlkit.common.sdkinternal.zzp.run(com.google.mlkit:common@@18.0.0:2)
W/cgr.qrmv.QrDetector( 9772):   at com.google.mlkit.common.sdkinternal.MlKitThreadPool.zze(com.google.mlkit:common@@18.0.0:4)
W/cgr.qrmv.QrDetector( 9772):   at com.google.mlkit.common.sdkinternal.MlKitThreadPool.zzc(com.google.mlkit:common@@18.0.0:1)
W/cgr.qrmv.QrDetector( 9772):   at com.google.mlkit.common.sdkinternal.zzi.run(Unknown Source:2)
W/cgr.qrmv.QrDetector( 9772):   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
W/cgr.qrmv.QrDetector( 9772):   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
W/cgr.qrmv.QrDetector( 9772):   at com.google.mlkit.common.sdkinternal.MlKitThreadPool.zzd(com.google.mlkit:common@@18.0.0:2)
W/cgr.qrmv.QrDetector( 9772):   at com.google.mlkit.common.sdkinternal.zzj.run(Unknown Source:2)
W/cgr.qrmv.QrDetector( 9772):   at java.lang.Thread.run(Thread.java:920)
W/cgr.qrmv.QrDetector( 9772): Caused by: java.lang.IllegalStateException: Image is already closed
W/cgr.qrmv.QrDetector( 9772):   at android.media.Image.throwISEIfImageIsInvalid(Image.java:73)
W/cgr.qrmv.QrDetector( 9772):   at android.media.ImageReader$SurfaceImage.getPlanes(ImageReader.java:1001)
W/cgr.qrmv.QrDetector( 9772):   at com.google.mlkit.vision.common.zzb.zzb(com.google.mlkit:vision-common@@17.0.0:1)
W/cgr.qrmv.QrDetector( 9772):   at com.google.mlkit.vision.common.InputImage.getPlanes(com.google.mlkit:vision-common@@17.0.0:1)
W/cgr.qrmv.QrDetector( 9772):   at com.google.mlkit.vision.barcode.internal.zzl.zza(com.google.android.gms:play-services-mlkit-barcode-scanning@@18.0.0:7)
W/cgr.qrmv.QrDetector( 9772):   at com.google.mlkit.vision.barcode.internal.zzi.zzc(com.google.android.gms:play-services-mlkit-barcode-scanning@@18.0.0:3)
W/cgr.qrmv.QrDetector( 9772):   at com.google.mlkit.vision.barcode.internal.zzi.run(com.google.android.gms:play-services-mlkit-barcode-scanning@@18.0.0:1)
W/cgr.qrmv.QrDetector( 9772):   at com.google.mlkit.vision.common.internal.MobileVisionBase.zza(com.google.mlkit:vision-common@@17.0.0:2)
W/cgr.qrmv.QrDetector( 9772):   at com.google.mlkit.vision.common.internal.zzd.call(Unknown Source:4)
W/cgr.qrmv.QrDetector( 9772):   at com.google.mlkit.common.sdkinternal.ModelResource.zza(com.google.mlkit:common@@18.0.0:8)
W/cgr.qrmv.QrDetector( 9772):   ... 10 more
D/InsetsSourceConsumer( 9772): ensureControlAlpha: for ITYPE_STATUS_BAR on com.szwlcc.app/com.szwlcc.app.MainActivity
I/ViewRootImpl@2f1181f[MainActivity]( 9772): ViewPostIme key 0
I/ViewRootImpl@2f1181f[MainActivity]( 9772): ViewPostIme key 1
GeoGlass commented 2 years ago

Same here. Using version qr_mobile_vision: ^4.0.1 image

RightFS commented 2 years ago

https://github.com/ADDInformatique/flutter_qr_mobile_vision @GeoGlass use this repo directly in your pubspec.yaml, it solved this problem.

GeoGlass commented 2 years ago

@RightFS It worked! Thank you! But it would be nice to know what happened that made it crash suddenly like that.

rmtmckenzie commented 1 year ago

This was an issue with timing and the frame being closed too early. I'm releasing a version today which includes those fixes and should resolve it.