What's the "UnsafeOptInUsageError"?

Viewed 1021

I'm using Google MLKit for barcode scanner. When I use imageProxy.image, IDE shows a warning;

" This declaration is opt-in and its usage should be marked with '@androidx.camera.core.ExperimentalGetImage' or '@OptIn(markerClass = androidx.camera.core.ExperimentalGetImage.class)'"

And it forces to use @SuppressLint("UnsafeOptInUsageError") annotation. I don't know what is it and couldn't find any resource(even official resource) about that. So why should this annotation be used?

1 Answers

This waring is from CameraX library rather ML Kit and you can suppress it by annotating the caller method with @ExperimentalGetImage like this.

Related