How do I use cordova-plugin-admob-free in Ionic 5

385 Views Asked by At

I am getting the following error when I try to add AdMob to my Ionic 5 app....

"export 'AdMobFreeOriginal' was not found in '@ionic-native/admob-free'

My code....

import { AdMobFreeOriginal, AdMobFreeBannerConfig } from '@ionic-native/admob-free';


@NgModule({
  declarations: [AppComponent],
  entryComponents: [],
    imports: [
        BrowserModule,
        IonicModule.forRoot(),
        AppRoutingModule,
        HttpClientModule,    ],
  providers: [
    StatusBar,
      SplashScreen,
      AdMobFreeOriginal,
    { provide: RouteReuseStrategy, useClass: IonicRouteStrategy }
  ],
  bootstrap: [AppComponent]
})
export class AppModule {}
1

There are 1 best solutions below

0
Tomas Vancoillie On BEST ANSWER

Import the plugin with /ngx at the end. You are also using an incorrect import. See the quote below.

@ionic-native/admob-free/ngx

You can always lookup the plugin on their repository. The import is stated in the plugin file:

@usage
* ```typescript
* import { AdMobFree, AdMobFreeBannerConfig } from '@ionic-native/admob-free/ngx';

https://github.com/ionic-team/ionic-native/blob/master/src/%40ionic-native/plugins/admob-free/index.ts