I am going through the CameraX tutorial at Android Developers https://developer.android.com/codelabs/camerax-getting-started#3 using version 1.1.0 of the library. The logs look good at first, but later a TimeoutException is raised and the camera preview remains black:
(omitted)
D/CameraStateRegistry: Recalculating open cameras:
Camera State
-------------------------------------------------------------------
Camera@f35a3d7[id=0] OPEN
Camera@e46a673[id=1] UNKNOWN
-------------------------------------------------------------------
Open count: 1 (Max allowed: 1)
D/CameraStateMachine: New public camera state CameraState{type=OPEN, error=null} from OPEN and null
D/CameraStateMachine: Publishing new public camera state CameraState{type=OPEN, error=null}
D/UseCaseAttachState: All use case: [androidx.camera.core.Preview-c7727ae2-d02c-4135-956c-a76c24deb02d40667318] for camera: 0
D/UseCaseAttachState: Active and attached use case: [androidx.camera.core.Preview-c7727ae2-d02c-4135-956c-a76c24deb02d40667318] for camera: 0
D/Camera2CameraImpl: {Camera@f35a3d7[id=0]} Transitioning camera internal state: OPENED --> OPENED
D/CameraStateMachine: New public camera state CameraState{type=OPEN, error=StateError{code=4, cause=java.util.concurrent.TimeoutException: Cannot complete surfaceList within 5000}} from OPEN and StateError{code=4, cause=java.util.concurrent.TimeoutException: Cannot complete surfaceList within 5000}
D/CameraStateMachine: Publishing new public camera state CameraState{type=OPEN, error=StateError{code=4, cause=java.util.concurrent.TimeoutException: Cannot complete surfaceList within 5000}}
My virtual hardware is Pixel 4 API 30, my Samsung A52s behaves in the same way. The code is the same as in the above tutorial, but in Java.
What am I doing wrong?