Ionic 4 screen orientation - Lock screen in portrait or landscape

I am trying to implement the screen orientation lock function found here

https://www.freakyjolly.com/ionic-4-set-screen-orientation-in-landscape-portrait-and-lock-unlock-using-ionic-native-plugin/

logging the current orientation and monitoring changes in orientation works fine. But when I try to lock screen orientation nothing happens and the screen continues to rotate when orientation is changed.

I am getting the following error message when the application attempts to lock the page:

  W/System.err: Caused by: java.lang.ClassNotFoundException: Didn't find class 
  "cordova.plugins.screenorientation.CDVOrientation" on path:

I am not sure if it is related, but whenever I open the the application in android studio (since adding the screen orientation), I get the following error pop up.

  Unsupported Modules Detected:
  Compilation is not supported for following modules: capacitor-android. Unfortunately you 
  can't have  non-Gradle Java modules and Android-Gradle modules in one project.

with the following message in the build

 ERROR: Unable to find module with Gradle path ':capacitor-android' (needed by modules: 
 'app',  'capacitor-video-player'.)

I can “invalidate caches / Restart” which removes the error in the build and can run the app. However I still get the error popup