The Constraint layout module needs to be installed in your Android Studio. To check if it's installed, go to Preferences > Appearance & Behavior > System Settings > Android and then SDK Tools. Check the Constraint Layout and install it.
Perform a deep restart of everything and then the error shouldn't be there anymore. This is a basic fix to the errors regarding the Constraint Layout.