CameraX Initialization Fails with "Available cameras: 0" on HMD Global Android 11 Devices
Component: CameraX (AndroidX Library)
Description: We're experiencing a CameraUnavailableException in production on multiple HMD Global (Nokia) devices running Android 11. The error occurs during ProcessCameraProvider.getInstance(context) — the log shows:
Caused by: androidx.camera.core.CameraUnavailableException: Device reporting less cameras than anticipated. Available cameras: 0
This happens intermittently and prevents users from accessing camera functionality.
Steps to reproduce:
1-install app using CameraX (1.3.x or 1.2.x) on an HMD Global (Nokia) device running Android 11 2-Call ProcessCameraProvider.getInstance(context) in onCreate or onResume 3-Occasionally, the call fails with Available cameras: 0
Expected behavior: CameraX should detect available cameras, as the device does have both front and back cameras. A retry or graceful fallback should be possible.
Actual behavior: Initialization fails, reporting 0 cameras, and the user cannot proceed. Rebooting the phone sometimes resolves the issue, which implies a race or initialization problem in the camera subsystem.
Device(s):
Manufacturer: HMD Global Model(s): (e.g., TA-1234, Nokia 5.4) Android version: Android 11 (API 30)