ionic4 admob-plugin Fehler
Home page ts code
import { PostsService } from "./../posts.service";
import { Component, OnInit } from "@angular/core";
import { Observable } from "rxjs";
import { Router } from "@angular/router";
import { ActivatedRoute, ParamMap } from "@angular/router";
import { switchMap } from "rxjs/operators";
import { AdMobFree, AdMobFreeBannerConfig } from '@ionic-native/admob-free';
@Component({
selector: "app-home",
templateUrl: "home.page.html",
styleUrls: ["home.page.scss"]
})
export class HomePage implements OnInit {
constructor(
private postSrvc: PostsService,
private router: Router,
private route: ActivatedRoute,
private admobFree: AdMobFree
) {
this.showBannerAd();
}
posts$: Observable<any>;
loadPost(post: any) {
this.router.navigate(["/posts", post.id]);
}
ngOnInit() {
this.posts$ = this.route.paramMap.pipe(
switchMap(
(params: ParamMap) =>
params.get("category")
? this.postSrvc.fetchPostsByCategory(params.get("category"))
: this.postSrvc.fetchPosts()
)
);
}
async showBannerAd() {
try {
const bannerConfig: AdMobFreeBannerConfig = {
id: 'unit id',
isTesting: true,
autoShow: true
}
this.adMobFree.banner.config(bannerConfig);
const result = await this.adMobFree.banner.prepare();
console.log(result);
}
catch (e) {
console.error(e);
}
}
}
app-Modul ts-code
import { HttpClientModule } from "@angular/common/http";
import { NgModule } from "@angular/core";
import { BrowserModule } from "@angular/platform-browser";
import { RouteReuseStrategy } from "@angular/router";
import { SplashScreen } from "@ionic-native/splash-screen/ngx";
import { StatusBar } from "@ionic-native/status-bar/ngx";
import { IonicModule, IonicRouteStrategy } from "@ionic/angular";
import { AppRoutingModule } from "./app-routing.module";
import { AppComponent } from "./app.component";
import { AdMobFree } from '@ionic-native/admob-free';
@NgModule({
declarations: [AppComponent],
entryComponents: [],
imports: [
BrowserModule,
IonicModule.forRoot(),
AppRoutingModule,
HttpClientModule
],
providers: [
StatusBar,
SplashScreen,
AdMobFree,
{ provide: RouteReuseStrategy, useClass: IonicRouteStrategy }
],
bootstrap: [AppComponent]
})
export class AppModule {}
alle Fehler
[ng] FEHLER in src/app/app.- Modul.ts(13,11): Fehler TS2345: Argument type '{ Deklarationen: (typeof AppComponent)[]; entryComponents: undefined[]; Importe: (ModuleWithProvid... " nicht zuordenbar parameter vom Typ 'NgModule'.
[ng] Arten der Eigenschaft "Anbieter" sind nicht kompatibel.
[ng] Geben '(typeof SplashScreen | AdMobFreeOriginal | { bieten: typeof RouteReuseStrategy; useClass: typeof... "ist nicht belegbar zu geben' - Anbieter[]'.
[ng] Typ 'typeof SplashScreen | AdMobFreeOriginal | { bieten: typeof RouteReuseStrategy; useClass: typeof ..." nicht zuordenbar geben Sie "Provider".
[ng] Typ 'AdMobFreeOriginal' nicht zuordenbar geben Sie "Provider".
[ng] Typ 'AdMobFreeOriginal' nicht zuordenbar Typ 'ClassProvider'.
[ng] - Eigenschaft "bereitstellen" fehlt im Art 'AdMobFreeOriginal'.
[ng] src/app/home/home.Seite.ts(19,24): Fehler TS2304: Cannot find-name 'AdMobFree'.
[ng] src/app/home/home.Seite.ts(48,12): Fehler TS2551: Eigenschaft 'adMobFree' existiert nicht auf Typ 'HomePage'. Meinst du 'admobFree'?
[ng] src/app/home/home.Seite.ts(50,33): Fehler TS2551: Eigenschaft 'adMobFree' existiert nicht auf Typ 'HomePage'. Meinst du 'admobFree'?