'admobfree.service.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property

My project is running.it is code working.I was use admob-free npm plugin then show the error on android build time.i was user firebase notification.I show all list of plugin and ionic info.

Show Error

ERROR in ./src/app/service/admobfree.service.ts Module build failed (from ./node_modules/@ngtools/webpack/src/index.js): Error: E:\git Live Project\service app\Service-User-App-\src\app\service\admobfree.service.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property. at AngularCompilerPlugin.getCompiledFile (E:\git Live Project\service app\Service-User-App-\node_modules@ngtools\webpack\src\angular_compiler_plugin.js:938:23) at E:\git Live Project\service app\Service-User-App-\node_modules@ngtools\webpack\src\loader.js:42:31 at runMicrotasks () at processTicksAndRejections (node:internal/process/task_queues:96:5) @ ./src/app/app.module.ts 29:0-63 56:12-28 @ ./src/main.ts @ multi ./src/main.ts [ERROR] An error occurred while running subprocess ng.

    ng.cmd run app:ionic-cordova-build:production --platform=android exited with exit code 1.

    Re-running this command with the --verbose flag may provide more information.

My ionic Info

Ionic:

   Ionic CLI                     : 6.19.0 (C:\Users\abc\AppData\Roaming\npm\node_modules\@ionic\cli)
   Ionic Framework               : @ionic/angular 5.5.2
   @angular-devkit/build-angular : 0.1000.8
   @angular-devkit/schematics    : 10.0.8
   @angular/cli                  : 10.0.8
   @ionic/angular-toolkit        : 2.3.3

Cordova:

   Cordova CLI       : 10.0.0
   Cordova Platforms : not available
   Cordova Plugins   : not available

Utility:

   cordova-res : 0.15.4
   native-run  : 1.5.0

System:

   Android SDK Tools : 26.1.1 (D:\androidsdk\Sdk)
   NodeJS            : v16.15.0 (C:\Program Files\nodejs\node.exe)
   npm               : 8.5.5
   OS                : Windows 10

My plugin Info

cordova-admob-sdk 0.24.1 "AdMob SDK"
cordova-plugin-add-swift-support 2.0.2 "AddSwiftSupport"
cordova-plugin-admob-free 0.27.0 "Cordova AdMob Plugin"
cordova-plugin-androidx-adapter 1.1.3 "cordova-plugin-androidx-adapter"
cordova-plugin-androidx 3.0.0 "cordova-plugin-androidx"
cordova-plugin-app-version 0.1.12 "AppVersion"
cordova-plugin-device 2.0.3 "Device"
cordova-plugin-file 6.0.2 "File"
cordova-plugin-firebasex 11.0.3 "Google Firebase Plugin"
cordova-plugin-geolocation 4.1.0 "Geolocation"
cordova-plugin-ionic-keyboard 2.2.0 "cordova-plugin-ionic-keyboard"
cordova-plugin-ionic-webview 4.2.1 "cordova-plugin-ionic-webview"
cordova-plugin-market 1.2.0 "Market"
cordova-plugin-nativegeocoder 3.4.1 "NativeGeocoder"
cordova-plugin-network-information 2.0.2 "Network Information"
cordova-plugin-statusbar 2.4.3 "StatusBar"
cordova-plugin-whitelist 1.3.4 "Whitelist"
cordova-plugin-x-socialsharing 6.0.2 "SocialSharing"
cordova-promise-polyfill 0.0.2 "cordova-promise-polyfill"
es6-promise-plugin 4.2.2 "Promise"

my service pagecode( admobfree.service.ts)

import { Injectable } from '@angular/core';
import {
  AdMobFree,
  AdMobFreeBannerConfig,
  AdMobFreeInterstitialConfig,
} from '@ionic-native/admob-free/ngx';

import { Platform } from '@ionic/angular';

@Injectable({
  providedIn: 'root'
})
export class AdmobfreeService {

  interstitialConfig: AdMobFreeInterstitialConfig = {
    isTesting: true, // Remove in production
    autoShow: false,
    id: "ca-app-pub-3940256099942544/1033173712"
};

  constructor(private admobFree: AdMobFree,public platform: Platform) {

    platform.ready().then(() => {
      this.admobFree.interstitial.config(this.interstitialConfig);
      this.admobFree.interstitial.prepare()
        .then(() => { }).catch(e => alert(e));
    });
    
    this.admobFree.on('admob.interstitial.events.CLOSE').subscribe(() => {
      this.admobFree.interstitial.prepare()
        .then(() => {}).catch(e => alert(e));
    });

  }

  showBannerAd() {
    let bannerConfig: AdMobFreeBannerConfig = {
        isTesting: true, // Remove in production
        autoShow: true,
        bannerAtTop: false,
        id: "ca-app-pub-3940256099942544/6300978111"
    };
    this.admobFree.banner.config(bannerConfig);
  
    this.admobFree.banner.prepare().then(() => {
        // success
    }).catch(e => alert(e));
  }

  showInterstitialAd() {
    this.admobFree.interstitial.isReady().then(() => {
      this.admobFree.interstitial.show().then(() => {
      })
        .catch(e =>alert("show "+e));
    })
      .catch(e =>alert("isReady "+e));
  }
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source