camera-samples icon indicating copy to clipboard operation
camera-samples copied to clipboard

java.lang.IllegalArgumentException: No supported surface combination is found for camera device - Id : 0 and Hardware level: 2

Open Razia-Whizcamp opened this issue 3 years ago • 5 comments

java.lang.IllegalArgumentException: No supported surface combination is found for camera device - Id : 0 and Hardware level: 2. May be the specified resolution is too large and not supported. Existing surfaces: [] New configs: [androidx.camera.core.impl.PreviewConfig@ee5c6b6, androidx.camera.video.impl.VideoCaptureConfig@80e1e51]

I have used same code cameraXVideo and CameraXbasic

Facing this issue on HMD Global Nokia 5.1 Plus Android 10, API 29

Working fine on below devices Vivo V2027 Android 10, API 29 OPPO CPH1909 Android 8.1.0, API 27

Razia-Whizcamp avatar Jun 13 '22 13:06 Razia-Whizcamp

Have you known how to fix this issue yet?

namdhis avatar Jan 09 '23 07:01 namdhis

Same problem here

jitash avatar Dec 01 '23 09:12 jitash

I have same problem. It may be because setTargetAspectRatio force use not supported resolution. And setTargetAspectRatio was deprecated, we should use ResolutionSelector. Like this

val resolutionStrategy = ResolutionSelector.Builder().setResolutionStrategy(
    ResolutionStrategy(
        android.util.Size(16, 9),
        ResolutionStrategy.FALLBACK_RULE_CLOSEST_HIGHER_THEN_LOWER
    )
).build()
provider.bindToLifecycle(
    mainActivity,
    camSelector,
    videoCapture,
    Preview.Builder()
    //.setTargetAspectRatio(quality.getAspectRatio())
        .setResolutionSelector(resolutionStrategy)
        .build().apply {
            setSurfaceProvider(previewView.surfaceProvider)
        }
)

storytellerF avatar Dec 28 '23 06:12 storytellerF