Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 48980

AdMob Free Not Working - No Provider?

$
0
0

I am trying to integrate the AdMob Free plugin into my ionic app : AdMob Free | Cordova Plugin Version of Google Admob for Free

Everything has installed for cordova and i have the following code in my app.component.ts:

constructor(
        private platform: Platform,
        private splashScreen: SplashScreen,
        private statusBar: StatusBar,
        public auth: AuthService,
        private adMob: AdMobFree

    ) {
        this.initializeApp();


        this.adMob.banner.config(this.bannerConfig);
        this.adMob.banner.prepare()
            .then(() => {
                console.log("ADMOB LOADED")

            }).catch(e => console.log("ADMOB ERROR",e));

    }

However i get the following error:

ERROR NullInjectorError: R3InjectorError(AppModule)[AdMobFree → AdMobFree → AdMobFree]:
NullInjectorError: No provider for AdMobFree!
at NullInjector.get (core.js:915)
at R3Injector.get (core.js:11082)
at R3Injector.get (core.js:11082)
at R3Injector.get (core.js:11082)
at NgModuleRef$1.get (core.js:24199)
at Object.get (core.js:22102)
at getOrCreateInjectable (core.js:3921)
at ɵɵdirectiveInject (core.js:13753)
at NodeInjectorFactory.AppComponent_Factory [as factory] (ɵfac.js? [sm]:1)
at getNodeInjectable (core.js:4029)

I have no idea how to solve this, i added AdMobFree to my providers in app.module but it doesn’t look like it’s actually a provider?

Does anyone know how to fix this?

Here is my package:

{
  "name": "Test",
  "version": "0.0.1",
  "author": "Ionic Framework",
  "homepage": "https://ionicframework.com/",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/common": "~10.0.0",
    "@angular/core": "~10.0.0",
    "@angular/forms": "~10.0.0",
    "@angular/platform-browser": "~10.0.0",
    "@angular/platform-browser-dynamic": "~10.0.0",
    "@angular/router": "~10.0.0",
    "@ionic-native/admob-free": "^5.36.0",
    "@ionic-native/core": "^5.36.0",
    "@ionic-native/in-app-browser": "^5.36.0",
    "@ionic-native/keyboard": "^5.36.0",
    "@ionic-native/splash-screen": "^5.36.0",
    "@ionic-native/status-bar": "^5.36.0",
    "@ionic/angular": "^5.8.5",
    "@ionic/pwa-elements": "^3.0.2",
    "base64-blob": "^1.4.1",
    "cordova-plugin-inappbrowser": "^5.0.0",
    "jetifier": "^2.0.0",
    "rxjs": "~6.5.5",
    "tslib": "^2.3.1",
    "zone.js": "~0.10.3"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.1000.0",
    "@angular/cli": "~10.0.5",
    "@angular/compiler": "~10.0.0",
    "@angular/compiler-cli": "~10.0.0",
    "@ionic/angular-toolkit": "^2.3.0",
    "@types/jasmine": "~3.5.0",
    "@types/jasminewd2": "^2.0.10",
    "@types/node": "^12.20.36",
    "codelyzer": "^6.0.2",
    "cordova-admob-sdk": "^0.24.1",
    "cordova-android": "^9.1.0",
    "cordova-ios": "^6.2.0",
    "cordova-plugin-admob-free": "^0.27.0",
    "cordova-plugin-androidx-adapter": "^1.1.3",
    "cordova-plugin-device": "^2.0.2",
    "cordova-plugin-file": "^6.0.2",
    "cordova-plugin-ionic-keyboard": "^2.2.0",
    "cordova-plugin-ionic-webview": "^4.2.1",
    "cordova-plugin-splashscreen": "^5.0.2",
    "cordova-plugin-statusbar": "^2.4.2",
    "cordova-plugin-whitelist": "^1.3.5",
    "cordova-promise-polyfill": "0.0.2",
    "jasmine-core": "~3.5.0",
    "jasmine-spec-reporter": "~5.0.0",
    "karma": "~5.0.0",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage-istanbul-reporter": "~3.0.2",
    "karma-jasmine": "~3.3.0",
    "karma-jasmine-html-reporter": "^1.7.0",
    "protractor": "~7.0.0",
    "ts-node": "~8.3.0",
    "tslint": "~6.1.0",
    "typescript": "^3.9.10"
  },
  "description": "An Ionic project",
  "cordova": {
    "plugins": {
      "cordova-plugin-whitelist": {},
      "cordova-plugin-statusbar": {},
      "cordova-plugin-device": {},
      "cordova-plugin-splashscreen": {},
      "cordova-plugin-ionic-webview": {
        "ANDROID_SUPPORT_ANNOTATIONS_VERSION": "27.+"
      },
      "cordova-plugin-ionic-keyboard": {},
      "cordova-plugin-androidx-adapter": {},
      "cordova-plugin-admob-free": {
        "ADMOB_APP_ID": "ca-app-pub-9723709551690178~7581882754"
      }
    },
    "platforms": [
      "ios",
      "android"
    ]
  }
}

2 posts - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 48980

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>