'Android Studio has no PreviewView

I am trying to implement a camera in my app, and am following the official guide. I am stuck at the part where I have to add a PreviewView to my layout, as I am unable to find it in the editor as shown here.

I have also copied and pasted the dependencies from the guide onto my app's build.grade as shown here. I have restarted Android Studio multiple times but PreviewView still does not show up in the layout editor. It however shows up if I try to import it in the Activity file.

I am using 2021.1.1 Patch 3.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source