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
756 stars 446 forks source link

[Android] [FATAL:flutter/shell/platform/android/surface_texture_external_texture.cc(56)] Check failed: state_ == AttachmentState::kAttached. #952

Closed ttb-inc closed 3 months ago

ttb-inc commented 3 months ago

Hi,

An error occurs on the Android device. The first time you run the camera, there is no error, but the second time, there is an error.

This hadn't happened before. This is a recent error.

Why is this error occurring?

I/BufferQueueConsumer(24030): [](id:5dde00000009,api:0,p:-1,c:24030) connect: controlledByApp=true
D/CameraOrientationUtil(24030): getRelativeImageRotation: destRotationDegrees=0, sourceRotationDegrees=90, isOppositeFacing=true, result=90
D/CameraOrientationUtil(24030): getRelativeImageRotation: destRotationDegrees=0, sourceRotationDegrees=90, isOppositeFacing=true, result=90
D/DynamicRangeResolver(24030): Resolved dynamic range for use case androidx.camera.core.Preview-cfa4c628-a1e2-4052-a067-f9b091a8e368 to no compatible HDR dynamic ranges.
D/DynamicRangeResolver(24030): DynamicRange@3d20eaf{encoding=UNSPECIFIED, bitDepth=0}
D/DynamicRangeResolver(24030): ->
D/DynamicRangeResolver(24030): DynamicRange@49168e{encoding=SDR, bitDepth=8}
D/CameraOrientationUtil(24030): getRelativeImageRotation: destRotationDegrees=0, sourceRotationDegrees=90, isOppositeFacing=true, result=90
D/DeferrableSurface(24030): Surface created[total_surfaces=1, used_surfaces=0](androidx.camera.core.processing.SurfaceEdge$SettableSurface@9e6bfb9}
D/DeferrableSurface(24030): Surface created[total_surfaces=2, used_surfaces=0](androidx.camera.core.SurfaceRequest$2@42a9e75}
D/DeferrableSurface(24030): New surface in use[total_surfaces=2, used_surfaces=1](androidx.camera.core.SurfaceRequest$2@42a9e75}
D/DeferrableSurface(24030): use count+1, useCount=1 androidx.camera.core.SurfaceRequest$2@42a9e75
D/CameraOrientationUtil(24030): getRelativeImageRotation: destRotationDegrees=0, sourceRotationDegrees=90, isOppositeFacing=true, result=90
I/BufferQueueConsumer(24030): [](id:5dde0000000a,api:0,p:-1,c:24030) connect: controlledByApp=true
D/CameraOrientationUtil(24030): getRelativeImageRotation: destRotationDegrees=0, sourceRotationDegrees=90, isOppositeFacing=true, result=90
I/BufferQueueConsumer(24030): [](id:5dde0000000b,api:0,p:-1,c:24030) connect: controlledByApp=true
D/CameraOrientationUtil(24030): getRelativeImageRotation: destRotationDegrees=0, sourceRotationDegrees=90, isOppositeFacing=true, result=90
D/DeferrableSurface(24030): Surface created[total_surfaces=3, used_surfaces=1](androidx.camera.core.impl.ImmediateSurface@6f840d6}
D/Camera2CameraImpl(24030): {Camera@75cb371[id=0]} Use case androidx.camera.core.Preview-cfa4c628-a1e2-4052-a067-f9b091a8e36854564029 ACTIVE
D/UseCaseAttachState(24030): Active and attached use case: [] for camera: 0
D/CameraOrientationUtil(24030): getRelativeImageRotation: destRotationDegrees=0, sourceRotationDegrees=90, isOppositeFacing=true, result=90
D/Camera2CameraImpl(24030): {Camera@75cb371[id=0]} Use case androidx.camera.core.ImageAnalysis-c0faa893-95ed-44c2-b859-043a7d592ab9117381810 ACTIVE
D/UseCaseAttachState(24030): Active and attached use case: [] for camera: 0
D/CameraOrientationUtil(24030): getRelativeImageRotation: destRotationDegrees=0, sourceRotationDegrees=90, isOppositeFacing=true, result=90
D/Camera2CameraImpl(24030): {Camera@75cb371[id=0]} Use cases [androidx.camera.core.Preview-cfa4c628-a1e2-4052-a067-f9b091a8e36854564029, androidx.camera.core.ImageAnalysis-c0faa893-95ed-44c2-b859-043a7d592ab9117381810] now ATTACHED
D/UseCaseAttachState(24030): All use case: [androidx.camera.core.Preview-cfa4c628-a1e2-4052-a067-f9b091a8e36854564029, androidx.camera.core.ImageAnalysis-c0faa893-95ed-44c2-b859-043a7d592ab9117381810] for camera: 0
D/UseCaseAttachState(24030): Active and attached use case: [androidx.camera.core.Preview-cfa4c628-a1e2-4052-a067-f9b091a8e36854564029, androidx.camera.core.ImageAnalysis-c0faa893-95ed-44c2-b859-043a7d592ab9117381810] for camera: 0
D/Camera2CameraImpl(24030): {Camera@75cb371[id=0]} Resetting Capture Session
D/Camera2CameraImpl(24030): {Camera@75cb371[id=0]} Releasing session in state INITIALIZED
D/Camera2CameraImpl(24030): {Camera@75cb371[id=0]} Attempting to force open the camera.
D/CameraStateRegistry(24030): tryOpenCamera(Camera@75cb371[id=0]) [Available Cameras: 1, Already Open: false (Previous state: CLOSED)] --> SUCCESS
D/CameraStateRegistry(24030): Recalculating open cameras:
D/CameraStateRegistry(24030): Camera                                       State                 
D/CameraStateRegistry(24030): -------------------------------------------------------------------
D/CameraStateRegistry(24030): Camera@7ed5fa9[id=1]                         UNKNOWN               
D/CameraStateRegistry(24030): Camera@d510c48[id=2]                         UNKNOWN               
D/CameraStateRegistry(24030): Camera@75cb371[id=0]                         OPENING               
D/CameraStateRegistry(24030): -------------------------------------------------------------------
D/CameraStateRegistry(24030): Open count: 1 (Max allowed: 1)
D/Camera2CameraImpl(24030): {Camera@75cb371[id=0]} Opening camera.
D/Camera2CameraImpl(24030): {Camera@75cb371[id=0]} Transitioning camera internal state: INITIALIZED --> OPENING
D/CameraStateMachine(24030): New public camera state CameraState{type=OPENING, error=null} from OPENING and null
D/CameraStateMachine(24030): Publishing new public camera state CameraState{type=OPENING, error=null}
D/UseCaseAttachState(24030): All use case: [androidx.camera.core.Preview-cfa4c628-a1e2-4052-a067-f9b091a8e36854564029, androidx.camera.core.ImageAnalysis-c0faa893-95ed-44c2-b859-043a7d592ab9117381810] for camera: 0
I/CameraManagerGlobal(24030): postSingleUpdate device: camera id 0 status STATUS_NOT_AVAILABLE
I/CameraManagerGlobal(24030): postSingleUpdate device: camera id 0 status STATUS_NOT_AVAILABLE
I/CameraManagerGlobal(24030): postSingleUpdate device: camera id 0 status STATUS_NOT_AVAILABLE
I/CameraManagerGlobal(24030): Camera 0 facing CAMERA_FACING_BACK state now CAMERA_STATE_OPEN for client metastar.nticka.dev API Level 2
D/Camera2CameraImpl(24030): {Camera@75cb371[id=0]} Use case androidx.camera.core.Preview-cfa4c628-a1e2-4052-a067-f9b091a8e36854564029 ACTIVE
D/UseCaseAttachState(24030): Active and attached use case: [androidx.camera.core.Preview-cfa4c628-a1e2-4052-a067-f9b091a8e36854564029, androidx.camera.core.ImageAnalysis-c0faa893-95ed-44c2-b859-043a7d592ab9117381810] for camera: 0
D/Camera2CameraImpl(24030): {Camera@75cb371[id=0]} Use case androidx.camera.core.ImageAnalysis-c0faa893-95ed-44c2-b859-043a7d592ab9117381810 ACTIVE
D/UseCaseAttachState(24030): Active and attached use case: [androidx.camera.core.Preview-cfa4c628-a1e2-4052-a067-f9b091a8e36854564029, androidx.camera.core.ImageAnalysis-c0faa893-95ed-44c2-b859-043a7d592ab9117381810] for camera: 0
D/Camera2CameraImpl(24030): {Camera@75cb371[id=0]} Issue capture request
D/UseCaseAttachState(24030): Active and attached use case: [androidx.camera.core.Preview-cfa4c628-a1e2-4052-a067-f9b091a8e36854564029, androidx.camera.core.ImageAnalysis-c0faa893-95ed-44c2-b859-043a7d592ab9117381810] for camera: 0
D/Camera2CameraImpl(24030): {Camera@75cb371[id=0]} CameraDevice.onOpened()
D/Camera2CameraImpl(24030): {Camera@75cb371[id=0]} Transitioning camera internal state: OPENING --> OPENED
D/CameraStateRegistry(24030): Recalculating open cameras:
D/CameraStateRegistry(24030): Camera                                       State                 
D/CameraStateRegistry(24030): -------------------------------------------------------------------
D/CameraStateRegistry(24030): Camera@7ed5fa9[id=1]                         UNKNOWN               
D/CameraStateRegistry(24030): Camera@d510c48[id=2]                         UNKNOWN               
D/CameraStateRegistry(24030): Camera@75cb371[id=0]                         OPEN                  
D/CameraStateRegistry(24030): -------------------------------------------------------------------
D/CameraStateRegistry(24030): Open count: 1 (Max allowed: 1)
D/CameraStateMachine(24030): New public camera state CameraState{type=OPEN, error=null} from OPEN and null
D/CameraStateMachine(24030): Publishing new public camera state CameraState{type=OPEN, error=null}
D/UseCaseAttachState(24030): All use case: [androidx.camera.core.Preview-cfa4c628-a1e2-4052-a067-f9b091a8e36854564029, androidx.camera.core.ImageAnalysis-c0faa893-95ed-44c2-b859-043a7d592ab9117381810] for camera: 0
D/UseCaseAttachState(24030): Active and attached use case: [androidx.camera.core.Preview-cfa4c628-a1e2-4052-a067-f9b091a8e36854564029, androidx.camera.core.ImageAnalysis-c0faa893-95ed-44c2-b859-043a7d592ab9117381810] for camera: 0
D/SyncCaptureSessionBase(24030): [androidx.camera.camera2.internal.SynchronizedCaptureSessionBaseImpl@eaa8e99] getSurface...done
D/CaptureSession(24030): Opening capture session.
D/DeferrableSurface(24030): use count+1, useCount=2 androidx.camera.core.SurfaceRequest$2@42a9e75
D/DeferrableSurface(24030): New surface in use[total_surfaces=3, used_surfaces=2](androidx.camera.core.impl.ImmediateSurface@6f840d6}
D/DeferrableSurface(24030): use count+1, useCount=1 androidx.camera.core.impl.ImmediateSurface@6f840d6
I/BufferQueueProducer(24030): [SurfaceTexture-0-24030-1](id:5dde00000009,api:4,p:1037,c:24030) connect: api=4 producerControlledByApp=true
I/BufferQueueProducer(24030): [ImageReader-640x480f23m4-24030-6](id:5dde0000000a,api:4,p:1037,c:24030) connect: api=4 producerControlledByApp=false
E/IMGSRV  (24030): :4697: IsTextureConsistent: IMGEGLImage is not consistent
D/CaptureSession(24030): Attempting to send capture request onConfigured
D/CaptureSession(24030): Issuing request for session.
D/Camera2CaptureRequestBuilder(24030): createCaptureRequest
E/IMGSRV  (24030): :4697: IsTextureConsistent: IMGEGLImage is not consistent
D/CaptureSession(24030): Issuing capture request.
I/CameraManagerGlobal(24030): Camera 0 facing CAMERA_FACING_BACK state now CAMERA_STATE_ACTIVE for client metastar.nticka.dev API Level 2
D/Camera2CaptureRequestBuilder(24030): createCaptureRequest
D/CaptureSession(24030): CameraCaptureSession.onConfigured() mState=OPENED
D/CaptureSession(24030): CameraCaptureSession.onReady() OPENED
E/IMGSRV  (24030): :4697: IsTextureConsistent: IMGEGLImage is not consistent
I/BufferQueueProducer(24030): [ImageReader-720x1516f1m3-24030-5](id:5dde00000008,api:1,p:24030,c:24030) disconnect: api 1
I/BufferQueueProducer(24030): [SurfaceView - metastar.nticka.dev/metastar.nticka.dev.MainActivity@78e0839@0#1(BLAST Consumer)1](id:5dde00000001,api:1,p:24030,c:24030) connect: api=1 producerControlledByApp=true
I/BufferQueueConsumer(24030): [ImageReader-720x1516f1m3-24030-5](id:5dde00000008,api:0,p:-1,c:24030) disconnect
F/flutter (24030): [FATAL:flutter/shell/platform/android/surface_texture_external_texture.cc(56)] Check failed: state_ == AttachmentState::kAttached. 
E/BufferQueueProducer(24030): [ImageReader-640x480f23m4-24030-6](id:5dde0000000a,api:4,p:1037,c:24030) waitForFreeSlotThenRelock TIMED_OUT 1000000000
E/BufferQueueProducer(24030): BQDUMP- BufferQueue mMaxAcquiredBufferCount=4 mMaxDequeuedBufferCount=12
E/BufferQueueProducer(24030): BQDUMP  mDequeueBufferCannotBlock=0 mAsyncMode=0
E/BufferQueueProducer(24030): BQDUMP  mQueueBufferCanDrop=0 mLegacyBufferDrop=1
E/BufferQueueProducer(24030): BQDUMP  default-size=[640x480] default-format=35 BQDUMP  transform-hint=00 frame-counter=16
E/BufferQueueProducer(24030): BQDUMP  mTransformHintInUse=00 mAutoPrerotation=0
E/BufferQueueProducer(24030): BQDUMPFIFO(16):
E/BufferQueueProducer(24030): BQDUMP(mConsumerName=ImageReader-640x480f23m4-24030-6, mConnectedApi=4, mConsumerUsageBits=3, mId=5dde0000000a, producer=[1037:???], consumer=[24030:metastar.nticka.dev])
E/BufferQueueProducer(24030): BQDUMP  00:0xb400007a14a65300 crop=[0,0,0,0] xform=0x04 time=86853.0393 scale=SCALE_TO_WINDOW
E/BufferQueueProducer(24030): BQDUMP  01:0xb400007ac332c800 crop=[0,0,0,0] xform=0x04 time=86853.0731 scale=SCALE_TO_WINDOW
E/BufferQueueProducer(24030): BQDUMP  02:0xb400007ac332c000 crop=[0,0,0,0] xform=0x04 time=86853.1069 scale=SCALE_TO_WINDOW
E/BufferQueueProducer(24030): BQDUMP  03:0xb400007abc825400 crop=[0,0,0,0] xform=0x04 time=86853.1407 scale=SCALE_TO_WINDOW
E/BufferQueueProducer(24030): BQDUMP  04:0xb400007a09bd8e00 crop=[0,0,0,0] xform=0x04 time=86853.1744 scale=SCALE_TO_WINDOW
E/BufferQueueProducer(24030): BQDUMP  05:0xb400007a2e449700 crop=[0,0,0,0] xform=0
E/BufferQueueProducer(24030): Slots:
E/BufferQueueProducer(24030): BQDUMP  [00:0xb400007a14a65300] state=QUEUED   0xb400007ac2e113c0 frame=1 [ 640x 480: 640, 23]
E/BufferQueueProducer(24030): BQDUMP  [01:0xb400007ac332c800] state=QUEUED   0xb400007ac2e11580 frame=2 [ 640x 480: 640, 23]
E/BufferQueueProducer(24030): BQDUMP  [02:0xb400007ac332c000] state=QUEUED   0xb400007ac2e10a20 frame=3 [ 640x 480: 640, 23]
E/BufferQueueProducer(24030): BQDUMP  [03:0xb400007abc825400] state=QUEUED   0xb4000078f4a53c40 frame=4 [ 640x 480: 640, 23]
E/BufferQueueProducer(24030): BQDUMP  [04:0xb400007a09bd8e00] state=QUEUED   0xb400007a098dba40 frame=5 [ 640x 480: 640, 23]
E/BufferQueueProducer(24030): BQDUMP  [05:0xb400007a2e449700] state=QUEUED   0xb400007a098dbb20 frame=6 [ 640x 480: 640, 23]
E/BufferQueueProducer(24030): BQDUMP  [06:0xb400007a0ef7fc00] state=QUEUED   0xb400007a2e5474e0 frame=7 [ 640x 480: 640, 23]
E/BufferQueueProducer(24030): BQDUMP  [07:0xb400007ac332cb00] state=QUEUED   0xb4000078f4a56b80 frame=8 [ 640x 480: 640, 23]
E/BufferQueueProducer(24030): BQDUMP  [08:0xb400007a0f242f00] state=QUEUED   0xb400007a098dbc00 frame=9 [ 640x 480: 640, 23]
E/BufferQueueProducer(24030): BQDUMP  [09:0xb400007ac328dc00] state=QUEUED   0xb4000078f4a56c60 frame=10 [ 640x 480: 640, 23]
E/BufferQueueProducer(24030): BQDUMP  [10:0xb400007a0f28d000] state=QUEUED   0xb400007a098dbce0
F/libc    (24030): Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 24030 (star.nticka.dev), pid 24030 (star.nticka.dev)
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'samsung/a12ks/a12:12/SP1A.210812.016/A125NKSS2CXA1:user/release-keys'
Revision: '7'
ABI: 'arm64'
Processor: '0'
Timestamp: 2024-02-06 13:36:15.751604163+0900
Process uptime: 51s
Cmdline: metastar.nticka.dev
pid: 24030, tid: 24030, name: star.nticka.dev  >>> metastar.nticka.dev <<<
uid: 10546
signal 6 (SIGABRT), code -1 (SI_QUEUE), fault addr --------
Abort message: '[FATAL:flutter/shell/platform/android/surface_texture_external_texture.cc(56)] Check failed: state_ == AttachmentState::kAttached. 
'
    x0  0000000000000000  x1  0000000000005dde  x2  0000000000000006  x3  0000007fd39b8e30
    x4  6d602e6c716e6573  x5  6d602e6c716e6573  x6  6d602e6c716e6573  x7  7f7f7f7f7f7f7f7f
    x8  00000000000000f0  x9  0000007b746930d8  x10 ffffff00fffffbdf  x11 0000000000000001
    x12 0000000000000000  x13 0000000016fb0390  x14 0000000000000000  x15 000000004cec4ec5
    x16 0000007b74768d20  x17 0000007b74743400  x18 0000007b7a052000  x19 00000000000000ac
    x20 0000000000005dde  x21 00000000000000b2  x22 0000000000005dde  x23 00000000ffffffff
    x24 0000007fd39b9518  x25 b400007a2e55cdd8  x26 0000000000000001  x27 0000000000000069
    x28 0000000000000001  x29 0000007fd39b8eb0
    lr  0000007b746f49d4  sp  0000007fd39b8e10  pc  0000007b746f4a04  pst 0000000000001000
backtrace:
      #00 pc 0000000000089a04  /apex/com.android.runtime/lib64/bionic/libc.so (abort+180) (BuildId: 9f4160992bb8de5917fe05c216139614)
      #01 pc 0000000001b98290  /data/app/~~ovK1feo_xW7YuO0EfbxgUA==/metastar.nticka.dev-4PM1dueIwYITsTlw-EOHDQ==/base.apk!libflutter.so (BuildId: 7d632fe175682e3332140196950e6522b3686271)
      #02 pc 0000000001bc21b0  /data/app/~~ovK1feo_xW7YuO0EfbxgUA==/metastar.nticka.dev-4PM1dueIwYITsTlw-EOHDQ==/base.apk!libflutter.so (BuildId: 7d632fe175682e3332140196950e6522b3686271)
      #03 pc 0000000001ba857c  /data/app/~~ovK1feo_xW7YuO0EfbxgUA==/metastar.nticka.dev-4PM1dueIwYITsTlw-EOHDQ==/base.apk!libflutter.so (BuildId: 7d632fe175682e3332140196950e6522b3686271)
      #04 pc 0000000001edcbc8  /data/app/~~ovK1feo_xW7YuO0EfbxgUA==/metastar.nticka.dev-4PM1dueIwYITsTlw-EOHDQ==/base.apk!libflutter.so (BuildId: 7d632fe175682e3332140196950e6522b3686271)
      #05 pc 0000000001ed764c  /data/app/~~ovK1feo_xW7YuO0EfbxgUA==/metastar.nticka.dev-4PM1dueIwYITsTlw-EOHDQ==/base.apk!libflutter.so (BuildId: 7d632fe175682e3332140196950e6522b3686271)
      #06 pc 0000000001edcef8  /data/app/~~ovK1feo_xW7YuO0EfbxgUA==/metastar.nticka.dev-4PM1dueIwYITsTlw-EOHDQ==/base.apk!libflutter.so (BuildId: 7d632fe175682e3332140196950e6522b3686271)
      #07 pc 0000000001ed764c  /data/app/~~ovK1feo_xW7YuO0EfbxgUA==/metastar.nticka.dev-4PM1dueIwYITsTlw-EOHDQ==/base.apk!libflutter.so (BuildId: 7d632fe175682e3332140196950e6522b3686271)
      #08 pc 0000000001edcef8  /data/app/~~ovK1feo_xW7YuO0EfbxgUA==/metastar.nticka.dev-4PM1dueIwYITsTlw-EOHDQ==/base.apk!libflutter.so (BuildId: 7d632fe175682e3332140196950e6522b3686271)
      #09 pc 0000000001ed764c  /data/app/~~ovK1feo_xW7YuO0EfbxgUA==/metastar.nticka.dev-4PM1dueIwYITsTlw-EOHDQ==/base.apk!libflutter.so (BuildId: 7d632fe175682e3332140196950e6522b3686271)
      #10 pc 0000000001ed66b0  /data/app/~~ovK1feo_xW7YuO0EfbxgUA==/metastar.nticka.dev-4PM1dueIwYITsTlw-EOHDQ==/base.apk!libflutter.so (BuildId: 7d632fe175682e3332140196950e6522b3686271)
      #11 pc 0000000001ed764c  /data/app/~~ovK1feo_xW7YuO0EfbxgUA==/metastar.nticka.dev-4PM1dueIwYITsTlw-EOHDQ==/base.apk!libflutter.so (BuildId: 7d632fe175682e3332140196950e6522b3686271)
      #12 pc 0000000001edcef8  /data/app/~~ovK1feo_xW7YuO0EfbxgUA==/metastar.nticka.dev-4PM1dueIwYITsTlw-EOHDQ==/base.apk!libflutter.so (BuildId: 7d632fe175682e3332140196950e6522b3686271)
      #13 pc 0000000001ed764c  /data/app/~~ovK1feo_xW7YuO0EfbxgUA==/metastar.nticka.dev-4PM1dueIwYITsTlw-EOHDQ==/base.apk!libflutter.so (BuildId: 7d632fe175682e3332140196950e6522b3686271)
      #14 pc 0000000001edcef8  /data/app/~~ovK1feo_xW7YuO0EfbxgUA==/metastar.nticka.dev-4PM1dueIwYITsTlw-EOHDQ==/base.apk!libflutter.so (BuildId: 7d632fe175682e3332140196950e6522b3686271)
      #15 pc 0000000001ed764c  /data/app/~~ovK1feo_xW7YuO0EfbxgUA==/metastar.nticka.dev-4PM1dueIwYITsTlw-EOHDQ==/base.apk!libflutter.so (BuildId: 7d632fe175682e3332140196950e6522b3686271)
      #16 pc 0000000001edcef8  /data/app/~~ovK1feo_xW7YuO0EfbxgUA==/metastar.nticka.dev-4PM1dueIwYITsTlw-EOHDQ==/base.apk!libflutter.so (BuildId: 7d632fe175682e3332140196950e6522b3686271)
      #17 pc 0000000001ed764c  /data/app/~~ovK1feo_xW7YuO0EfbxgUA==/metastar.nticka.dev-4PM1dueIwYITsTlw-EOHDQ==/base.apk!libflutter.so (BuildId: 7d632fe175682e3332140196950e6522b3686271)
      #18 pc 0000000001edb558  /data/app/~~ovK1feo_xW7YuO0EfbxgUA==/metastar.nticka.dev-4PM1dueIwYITsTlw-EOHDQ==/base.apk!libflutter.so (BuildId: 7d632fe175682e3332140196950e6522b3686271)
      #19 pc 0000000001ed3fe4  /data/app/~~ovK1feo_xW7YuO0EfbxgUA==/metastar.nticka.dev-4PM1dueIwYITsTlw-EOHDQ==/base.apk!libflutter.so (BuildId: 7d632fe175682e3332140196950e6522b3686271)
      #20 pc 0000000001ed3e10  /data/app/~~ovK1feo_xW7YuO0EfbxgUA==/metastar.nticka.dev-4PM1dueIwYITsTlw-EOHDQ==/base.apk!libflutter.so (BuildId: 7d632fe175682e3332140196950e6522b3686271)
      #21 pc 0000000001fdce88  /data/app/~~ovK1feo_xW7YuO0EfbxgUA==/metastar.nticka.dev-4PM1dueIwYITsTlw-EOHDQ==/base.apk!libflutter.so (BuildId: 7d632fe175682e3332140196950e6522b3686271)
      #22 pc 0000000001fdbe04  /data/app/~~ovK1feo_xW7YuO0EfbxgUA==/metastar.nticka.dev-4PM1dueIwYITsTlw-EOHDQ==/base.apk!libflutter.so (BuildId: 7d632fe175682e3332140196950e6522b3686271)
      #23 pc 0000000001fdc554  /data/app/~~ovK1feo_xW7YuO0EfbxgUA==/metastar.nticka.dev-4PM1dueIwYITsTlw-EOHDQ==/base.apk!libflutter.so (BuildId: 7d632fe175682e3332140196950e6522b3686271)
      #24 pc 0000000001fdd734  /data/app/~~ovK1feo_xW7YuO0EfbxgUA==/metastar.nticka.dev-4PM1dueIwYITsTlw-EOHDQ==/base.apk!libflutter.so (BuildId: 7d632fe175682e3332140196950e6522b3686271)
      #25 pc 0000000001fdc180  /data/app/~~ovK1feo_xW7YuO0EfbxgUA==/metastar.nticka.dev-4PM1dueIwYITsTlw-EOHDQ==/base.apk!libflutter.so (BuildId: 7d632fe175682e3332140196950e6522b3686271)
      #26 pc 0000000001fdbf40  /data/app/~~ovK1feo_xW7YuO0EfbxgUA==/metastar.nticka.dev-4PM1dueIwYITsTlw-EOHDQ==/base.apk!libflutter.so (BuildId: 7d632fe175682e3332140196950e6522b3686271)
      #27 pc 0000000001fe982c  /data/app/~~ovK1feo_xW7YuO0EfbxgUA==/metastar.nticka.dev-4PM1dueIwYITsTlw-EOHDQ==/base.apk!libflutter.so (BuildId: 7d632fe175682e3332140196950e6522b3686271)
      #28 pc 0000000001bc2d68  /data/app/~~ovK1feo_xW7YuO0EfbxgUA==/metastar.nticka.dev-4PM1dueIwYITsTlw-EOHDQ==/base.apk!libflutter.so (BuildId: 7d632fe175682e3332140196950e6522b3686271)
      #29 pc 0000000001bc8840  /data/app/~~ovK1feo_xW7YuO0EfbxgUA==/metastar.nticka.dev-4PM1dueIwYITsTlw-EOHDQ==/base.apk!libflutter.so (BuildId: 7d632fe175682e3332140196950e6522b3686271)
      #30 pc 0000000000016bb0  /system/lib64/libutils.so (android::Looper::pollInner(int)+912) (BuildId: fdd9463bf161fd8af02189342811ed6d)
      #31 pc 00000000000167b8  /system/lib64/libutils.so (android::Looper::pollOnce(int, int*, int*, void**)+112) (BuildId: fdd9463bf161fd8af02189342811ed6d)
      #32 pc 000000000015294c  /system/lib64/libandroid_runtime.so (android::android_os_MessageQueue_nativePollOnce(_JNIEnv*, _jobject*, long, int)+44) (BuildId: 24c2d1a02b476e07cc69c9c9f2a357a6)
      #33 pc 0000000000460504  /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (art_jni_trampoline+116)
Lost connection to device.

[My env.] mobile_scanner: 4.0.0 # https://pub.dev/packages/mobile_scanner/versions

[✓] Flutter (Channel stable, 3.16.9, on macOS 14.3 23D56 darwin-arm64, locale ko-KR) • Flutter version 3.16.9 on channel stable at /Users/jeonglockpark/Desktop/work/flutter_sdk/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 41456452f2 (11 days ago), 2024-01-25 10:06:23 -0800 • Engine revision f40e976bed • Dart version 3.2.6 • DevTools version 2.28.5

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0) • Android SDK at /Users/jeonglockpark/Library/Android/sdk • Platform android-34, build-tools 34.0.0 • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 17.0.7+0-17.0.7b1000.6-10550314) • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.2) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 15C500b • CocoaPods version 1.15.0

[✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2023.1) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 17.0.7+0-17.0.7b1000.6-10550314)

[✓] VS Code (version 1.86.0) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension can be installed from: 🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (4 available) • SM A125N (mobile) • R59R700M14X • android-arm64 • Android 12 (API 31) • Chrome (web) • chrome • web-javascript • Google Chrome 121.0.6167.139

[✓] Network resources • All expected network resources are available.

• No issues found!

ttb-inc commented 3 months ago

A version that was working fine before also throws an error. I think there is a conflict with the Android OS or the Flutter SDK.

ttb-inc commented 3 months ago

By the way, if it delays the breakpoint a bit before building, It works fine.

ttb-inc commented 3 months ago

It definitely works the first time. The second time it doesn't.

ttb-inc commented 3 months ago

I used startDelay: true and it worked fine.

We are creating a new instance and outputting it as an independent Widget View, not a PageView.

Is this the right way to use it?

Thank you.

[My code]

Scaffold(
      body: SafeArea(
        child: Stack(
          children: [
            /// scanner
            MobileScanner(
              controller: MobileScannerController(formats: [BarcodeFormat.qrCode]),
              startDelay: true, // <-- new flag
              onDetect: (BarcodeCapture barcodes) {
                if (detectedCode != null) {
                  return;
                }

                if (barcodes.barcodes.isNotEmpty) {
                  detectedCode = barcodes.barcodes[0].rawValue ?? '';
                  if (widget.onDetect != null) {
                    widget.onDetect!(detectedCode);
                  }

                  pop();
                }
              },
              scanWindow: scanWindow,
            ),

            /// scanner overlay
            RepaintBoundary(
              child: CustomPaint(
                painter: _ScannerOverlay(
                  scanWindow: scanWindow,
                  color: widget.themeColor,
                  radius: widget.viewFinderRadius,
                  strokeWidth: widget.viewFinderStrokeWidth,
                  canScanLine: widget.canScanLine,
                  scanLineColor: widget.scanLineColor,
                  scanLineStrokeWidth: widget.scanLineStrokeWidth,
                ),
              ),
            ),

            /// overlay Widget
            widget.overlayWidget,
          ],
        ),
      ),
    );
ttb-inc commented 3 months ago

Is there any way to handle startDelay: true when the camera is shut down, not when it starts up? If it could be pre-initialized, it would be a little faster on the next run.

Thank you.

navaronbracke commented 3 months ago

This seems to be related? https://github.com/flutter/flutter/issues/138947

The issue seems to be fixed on the master channel at the moment, so this will be included in the next Flutter stable release, that is due sometime this month. If you switch to the master channel, does the issue occur?

ttb-inc commented 3 months ago

Is 'startDelay: true' just a time delay? Is it 1.5s? It certainly seems like a long time, is there a reason?

    if (widget.startDelay) {
      await Future.delayed(const Duration(seconds: 1, milliseconds: 500));
    }
ttb-inc commented 3 months ago

This seems to be related? flutter/flutter#138947

The issue seems to be fixed on the master channel at the moment, so this will be included in the next Flutter stable release, that is due sometime this month. If you switch to the master channel, does the issue occur?

I haven't checked the github master version yet. I'll check the master version or wait for the next patch.

Thank you.

navaronbracke commented 3 months ago

The start delay is an older parameter that was left in from older releases.

It will be removed in the next major release.

ttb-inc commented 3 months ago

This seems to be related? flutter/flutter#138947

The issue seems to be fixed on the master channel at the moment, so this will be included in the next Flutter stable release, that is due sometime this month. If you switch to the master channel, does the issue occur?

I've verified that it works on the master version. Hopefully it will work with the next update.

Thanks a lot.

[✓] Flutter (Channel master, 3.20.0-2.0.pre.18, on macOS 14.3 23D56 darwin-arm64, locale ko-KR)
    • Flutter version 3.20.0-2.0.pre.18 on channel master at /Users/jeonglockpark/Desktop/work/flutter_sdk/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 0903bf7055 (4 hours ago), 2024-02-05 21:42:40 -0800
    • Engine revision 808886312e
    • Dart version 3.4.0 (build 3.4.0-104.0.dev)
    • DevTools version 2.32.0
navaronbracke commented 3 months ago

I'll keep this issue open and will monitor for the stable release. Once that lands and the fix is verified to be in stable, we can close this issue.

ttb-inc commented 3 months ago

I'll keep this issue open and will monitor for the stable release. Once that lands and the fix is verified to be in stable, we can close this issue.

I've checked the stable version and found no issues.

[✓] Flutter (Channel stable, 3.19.0, on macOS 14.3.1 23D60 darwin-arm64, locale ko-KR)

Thanks a lot.