Reputation: 679
I'm working with an Android emulator (api 29) and when I try to capture a photo like this:
imageCapture?.takePicture(cameraExecutor, object : ImageCapture.OnImageCapturedCallback() {
...
override fun onCaptureSuccess(image: ImageProxy) {
....
// should show a preview before sending the picture to the web service
}
}
it freezes. This only happens with an emulator!
I have the following error:
D/Camera2CameraImpl: {Camera@683e74c[id=0]} Resetting Capture Session
E/CameraCaptureSession: Session 0: Exception while stopping repeating:
android.hardware.camera2.CameraAccessException: CAMERA_ERROR (3): The camera device has encountered a serious error
at android.hardware.camera2.impl.CameraDeviceImpl.checkIfCameraClosedOrInError(CameraDeviceImpl.java:2521)
at android.hardware.camera2.impl.CameraDeviceImpl.stopRepeating(CameraDeviceImpl.java:1128)
at android.hardware.camera2.impl.CameraCaptureSessionImpl.close(CameraCaptureSessionImpl.java:526)
Upvotes: 9
Views: 5081
Reputation: 740
I've also faced this same problem in pixel 3 (sdk 31). This was indeed the problem with the emulator.
Thanks to #Krahmal (Topic's main comment section) helped to fixed a part of the problem but not 100%
For my case pixel 4 with android 10 (sdk 29) working fine(which may not in your case). Although it works with physical device.
Thanks
Upvotes: 1