androidandroid-cameraandroid-camera2android-12

ERROR_CAMERA_DEVICE - when taking a photo on Android 12 (S) Pixel emulator


In my app I use code to take photo from official camera2 sample https://github.com/android/camera-samples/tree/main/Camera2Basic

I updated my app project from 30 SDK to 31 SDK and checked taking photos on Pixel 3 emulator with Android 12 (S) but it fails to take photos with ERROR_CAMERA_DEVICE error

In official sample it crashes with the same error at https://github.com/android/camera-samples/blob/main/Camera2Basic/app/src/main/java/com/example/android/camera2/basic/fragments/CameraFragment.kt#L286

 java.lang.RuntimeException: Camera 0 error: (4) Fatal (device)
        at com.example.android.camera2.basic.fragments.CameraFragment$openCamera$2$1.onError(CameraFragment.kt:276)
E/CameraCaptureSession: Session 0: Exception while stopping repeating: 
    android.hardware.camera2.CameraAccessException: CAMERA_ERROR (3): The camera device has encountered a serious error

Anyone tried this sample on real device with the newest Android (12)?


Solution

  • Android 12 Emulator issue.

    Will be fixed with an update soon https://github.com/android/camera-samples/issues/432#issuecomment-952121904