Problems with capacitor-community/admob

I am new to Ionic Capacitor and only use VanillaJS. I am trying to incorporate admob ads in my app using capacitor-community/admob.

The app includes a script module to initialize AdMob:

import { AdMob } from ‘@capacitor-community/admob’;
export async function initialize(): Promise {
const { status } = await AdMob.trackingAuthorizationStatus();

AdMob.initialize({
requestTrackingAuthorization: false,
testingDevices: [’’],
initializeForTesting: true
});
}

import { AdMob, BannerAdOptions, BannerAdSize, BannerAdPosition, BannerAdPluginEvents, AdMobBannerSize } from ‘@capacitor-community/admob’;
export async function banner(): Promise {
AdMob.addListener(BannerAdPluginEvents.Loaded, () => {
// Subscribe Banner Event Listener
});

AdMob.addListener(BannerAdPluginEvents.SizeChanged, (size: AdMobBannerSize) => {
  // Subscribe Change Banner Size
});

const options: BannerAdOptions = {
  adId: 'ca-app-pub-5945756152961868/4894006670',
  adSize: BannerAdSize.BANNER,
  position: BannerAdPosition.BOTTOM_CENTER,
  margin: 0,
  isTesting: true
  // npa: true
};
AdMob.showBanner(options);

}

  1. Any use of AdMob in the javascript code causes an error and the app stops working. Why is the AdMob class not available?

  2. For the banner exports above, can an example of the code for the Subscribes be provided?

Did you run npx cap sync after installing the code?
If so, try hitting the gradle sync button on Android Studio (elephant shape)

Yes, I have done both those syncs. The above import and export code is in an included script module. The following code in my initialization Javascript code causes the app to fail on launch:

AdMob.initialize();
if (AdMob) {
	alert("Admob success")
} else {
	alert("Admob failed")
}