Hello help me
how to fix this error ?
Cannot find name 'AdMobFree
My cordova plugin info :
Hello,
it seems that your problem is in app.module.ts line 11. Maybe it helps people, if you post relevant code. Code , not pictures.
Best regards, anna–liebt
This is code home.ts
import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';
import { AdMobFree, AdMobFreeBannerConfig } from '@ionic-native/admob-free';
@Component({
selector: 'page-home',
templateUrl: 'home.html'
})
export class HomePage {
constructor(public navCtrl: NavController, private admobFree: AdMobFree) {
}
showBanner(){
const bannerConfig: AdMobFreeBannerConfig = {
id: 'ca-app-pu-8090477820877890/9056890967',
isTesting: true,
autoShow: true
};
this.admobFree.banner.config(bannerConfig);
this.admobFree.banner.prepare()
.then(() => {
})
.catch(e => console.log(e));
}
}
app.module.ts
import { BrowserModule } from '@angular/platform-browser';
import { ErrorHandler, NgModule } from '@angular/core';
import { IonicApp, IonicErrorHandler, IonicModule } from 'ionic-angular';
import { SplashScreen } from '@ionic-native/splash-screen';
import { StatusBar } from '@ionic-native/status-bar';
import { AdMobFree} from '@ionic-native/admob-free';
import { MyApp } from './app.component';
import { HomePage } from '../pages/home/home';
@NgModule({
declarations: [
MyApp,
HomePage,
],
imports: [
BrowserModule,
IonicModule.forRoot(MyApp)
],
bootstrap: [IonicApp],
entryComponents: [
MyApp,
HomePage
],
providers: [
StatusBar,
SplashScreen,
AdMobFree,
{provide: ErrorHandler, useClass: IonicErrorHandler}
]
})
export class AppModule {}
please help me
Okay,
code looks, as far as I see; good.
Have you installed both
ionic cordova plugin add cordova-plugin-admob-free
npm install @ionic-native/admob-free
proper? Are the entrys in package.json correct?
Best regards, anna-liebt
“npm install --save @ionic-native/plugin-name@4”, now u need to install version 4.x.x for all plugins if use ionic 3, sorry my english is bad.
i have installed
this package.json
{
"name": "bukuapp",
"version": "0.0.1",
"author": "Ionic Framework",
"homepage": "http://ionicframework.com/",
"private": true,
"scripts": {
"start": "ionic-app-scripts serve",
"clean": "ionic-app-scripts clean",
"build": "ionic-app-scripts build",
"lint": "ionic-app-scripts lint"
},
"dependencies": {
"@angular/animations": "5.2.11",
"@angular/common": "5.2.11",
"@angular/compiler": "5.2.11",
"@angular/compiler-cli": "5.2.11",
"@angular/core": "5.2.11",
"@angular/forms": "5.2.11",
"@angular/http": "5.2.11",
"@angular/platform-browser": "5.2.11",
"@angular/platform-browser-dynamic": "5.2.11",
"@ionic-native/admob": "^5.0.0",
"@ionic-native/admob-free": "^5.0.0",
"@ionic-native/app-rate": "^5.0.0",
"@ionic-native/core": "^5.0.0",
"@ionic-native/social-sharing": "^5.0.0",
"@ionic-native/splash-screen": "~4.18.0",
"@ionic-native/status-bar": "~4.18.0",
"@ionic/pro": "2.0.4",
"@ionic/storage": "2.2.0",
"all": "0.0.0",
"cordova-admob-sdk": "^0.22.0",
"cordova-android": "7.1.4",
"cordova-plugin-admob-free": "0.25.0",
"cordova-plugin-apprate": "1.4.0",
"cordova-plugin-device": "^2.0.2",
"cordova-plugin-dialogs": "2.0.1",
"cordova-plugin-globalization": "1.11.0",
"cordova-plugin-inappbrowser": "3.0.0",
"cordova-plugin-ionic-keyboard": "^2.1.3",
"cordova-plugin-ionic-webview": "^2.3.2",
"cordova-plugin-nativestorage": "2.3.2",
"cordova-plugin-splashscreen": "^5.0.2",
"cordova-plugin-statusbar": "^2.4.2",
"cordova-plugin-whitelist": "^1.3.3",
"cordova-plugin-x-socialsharing": "5.4.4",
"cordova-promise-polyfill": "0.0.2",
"es6-promise-plugin": "4.2.2",
"ionic-angular": "3.9.2",
"ionicons": "3.0.0",
"promise-polyfill": "^8.1.0",
"rxjs": "^5.5.0",
"rxjs-compat": "^6.3.3",
"splash-screen": "4.0.1",
"sw-toolbox": "3.6.0",
"zone.js": "0.8.26"
},
"devDependencies": {
"@ionic/app-scripts": "3.2.1",
"typescript": "~2.6.2"
},
"description": "An Ionic project",
"cordova": {
"plugins": {
"cordova-plugin-admob-free": {
"ADMOB_APP_ID": "ca-app-pub-1312092729851913~6922673794"
},
"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-x-socialsharing": {
"ANDROID_SUPPORT_V4_VERSION": "24.1.1+"
},
"cordova-plugin-apprate": {}
},
"platforms": [
"android"
]
}
}
now i get error : Object(…) is not a function
this is more info
i will try …thanks
Hello,
as @goku-dev said, install ionic-native version 4.
It is simple. Everywhere is @ionic-native …"^5.0.0" replace ."^5.0.0" with “~4.18.0” and then run in console
npm i
If you change to ionic 4 then native version 5 is needed.
Best regards, anna-liebt
I have fix this issue
thanks friends…
how did you solved this issue
which version of plugin you used.