TomerPacific/MediumArticles

App crash when capture button is pressed

Closed this issue · 4 comments

following is the error:

android.hardware.camera2.CameraAccessException: CAMERA_ERROR (3): The camera device has encountered a serious error
        at android.hardware.camera2.impl.CameraDeviceImpl.checkIfCameraClosedOrInError(CameraDeviceImpl.java:2350)
        at android.hardware.camera2.impl.CameraDeviceImpl.stopRepeating(CameraDeviceImpl.java:1277)
        at android.hardware.camera2.impl.CameraCaptureSessionImpl.close(CameraCaptureSessionImpl.java:579)
        at android.hardware.camera2.impl.CameraCaptureSessionImpl$2.onDisconnected(CameraCaptureSessionImpl.java:790)
        at android.hardware.camera2.impl.CameraDeviceImpl$7.run(CameraDeviceImpl.java:259)
        at android.os.Handler.handleCallback(Handler.java:938)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loopOnce(Looper.java:201)
        at android.os.Looper.loop(Looper.java:288)
        at android.os.HandlerThread.run(HandlerThread.java:67)

Hi @Pawandeep-prog , thanks for opening the issue.
Can you provide some more information about the crash?

  • How to reproduce it?
  • What device you used (and API level)?

Thanks

Hi @TomerPacific
I got this error on PIXEL_5 api 31 emulator

To reproduce this error,
I first tried to write code on my own I then received the above error
then I copied your code as it is then also I got same error when I press capture image button.

I think I should try to run this code once on real physical device too.

@Pawandeep-prog - Thanks for providing more information.
I would highly advise to try and reproduce this on a physical device.
It would also help if you add the complete stacktrace/log output.

I think the issue is with emulator itself .
On proper physical device it is running totally fine.
Thanks for your response.