Error When Using Android CaptureRequest.CONTROL_ZOOM_RATIO

Viewed 279

I just updated my project to Androidx and upgraded to SDK version 30, but when I want to adjust my zoom value I got

java.lang.NoSuchFieldError: No static field CONTROL_ZOOM_RATIO of type Landroid/hardware/camera2/CaptureRequest$Key; in class Landroid/hardware/camera2/CaptureRequest; or its superclasses (declaration of 'android.hardware.camera2.CaptureRequest' appears in /system/framework/framework.jar)

The code that went wrong is:

builder.set(CaptureRequest.CONTROL_ZOOM_RATIO,newZoom);
1 Answers

CONTROL_ZOOM_RATIO is supported starting from API level 30. Did you run you app on the device that has API level 30 or higher ?

Related