camera-samples
camera-samples copied to clipboard
java.lang.IllegalArgumentException: No supported surface combination is found for camera device - Id : 0 and Hardware level: 2
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
Have you known how to fix this issue yet?
Same problem here
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)
}
)