I am trying to build my ionic project for production, by using the following command.
ionic cordova build android --prod --release, but i always have this error :
JavaScript heap out of memory, so i looked on the web and i tried the following solution : the adding of node --max_old_space_size=4096 in my ionic.cmd file, but it did not worked. As i use firebase, i tried to downgrade firebase using this command :
npm install --save firebase#4.x
So now the GooglePlus class of googleplus plugin of my project is not recognised as an ionic provider. Here are the commands i used to install it :
ionic cordova plugin add cordova-plugin-googleplus --save --variable REVERSED_CLIENT_ID=MY_REVERSE_CLIENT_ID
npm install --save #ionic-native/google-plus
When i am trying to import the GooglePlus class in my app.modules.ts, in the providers section, it is not recognised. I tried to uninstall and re-install everything but it does not work.
{
"name": "app name",
"version": "2.0.1",
"author": "auhtors name",
"homepage": "website url",
"private": true,
"scripts": {
"clean": "ionic-app-scripts clean",
"build": "ionic-app-scripts build",
"lint": "ionic-app-scripts lint",
"ionic:build": "ionic-app-scripts build",
"ionic:serve": "ionic-app-scripts serve"
},
"dependencies": {
"#angular/animations": "5.2.10",
"#angular/common": "5.2.10",
"#angular/compiler": "5.2.10",
"#angular/compiler-cli": "5.2.10",
"#angular/core": "5.2.10",
"#angular/fire": "^5.0.0",
"#angular/forms": "5.2.10",
"#angular/http": "5.2.10",
"#angular/platform-browser": "5.2.10",
"#angular/platform-browser-dynamic": "5.2.10",
"#ionic-native/admob-free": "^4.7.0",
"#ionic-native/admob-pro": "^4.19.0",
"#ionic-native/app-version": "^4.8.0",
"#ionic-native/barcode-scanner": "^4.19.0",
"#ionic-native/browser-tab": "^4.19.0",
"#ionic-native/camera": "^4.7.0",
"#ionic-native/core": "4.7.0",
"#ionic-native/facebook": "^4.19.0",
"#ionic-native/file": "^4.8.0",
"#ionic-native/file-transfer": "^4.7.0",
"#ionic-native/firebase": "^4.13.0",
"#ionic-native/google-plus": "^5.0.0",
"#ionic-native/in-app-browser": "^4.7.0",
"#ionic-native/instagram": "^4.19.0",
"#ionic-native/local-notifications": "^4.13.0",
"#ionic-native/network": "^4.7.0",
"#ionic-native/open-native-settings": "^4.7.0",
"#ionic-native/social-sharing": "^4.7.0",
"#ionic-native/splash-screen": "4.7.0",
"#ionic-native/status-bar": "^4.7.0",
"#ionic-native/youtube-video-player": "^4.7.0",
"#ionic/storage": "2.1.3",
"angular-pipes": "^8.0.0",
"angularfire2": "^5.1.1",
"cordova-admob-sdk": "^0.17.0",
"cordova-android": "^7.1.4",
"cordova-instagram-plugin": "^0.5.7",
"cordova-ios": "^4.5.5",
"cordova-open-native-settings": "^1.5.2",
"cordova-plugin-add-swift-support": "^1.7.2",
"cordova-plugin-admob-free": "^0.17.4",
"cordova-plugin-admobpro": "^2.37.1",
"cordova-plugin-app-version": "^0.1.9",
"cordova-plugin-badge": "^0.8.7",
"cordova-plugin-camera": "^4.0.3",
"cordova-plugin-device": "^2.0.2",
"cordova-plugin-document-viewer": "^0.9.10",
"cordova-plugin-extension": "^1.5.4",
"cordova-plugin-facebook4": "^4.1.0",
"cordova-plugin-file": "^6.0.1",
"cordova-plugin-file-transfer": "^1.7.1",
"cordova-plugin-firebase": "^2.0.2",
"cordova-plugin-inappbrowser": "^3.0.0",
"cordova-plugin-ionic-keyboard": "^2.1.3",
"cordova-plugin-ionic-webview": "^3.1.0",
"cordova-plugin-local-notification": "^0.9.0-beta.2",
"cordova-plugin-network-information": "^2.0.1",
"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-plugin-youtube-video-player": "^1.0.6",
"cordova-promise-polyfill": "0.0.2",
"cordova-universal-clipboard": "git+https://github.com/Visigo/CordovaClipboard.git",
"es6-promise-plugin": "^4.2.2",
"firebase": "^5.8.2",
"ionic-angular": "3.9.2",
"ionic-img-viewer": "^2.9.0",
"ionicons": "3.0.0",
"moment": "^2.22.2",
"ng2-pdf-viewer": "^5.1.0",
"ng2-simple-timer": "^1.3.3",
"ngx-moment": "^3.1.0",
"phonegap-plugin-barcodescanner": "^8.0.0",
"rxjs": "5.5.11",
"sw-toolbox": "3.6.0",
"zone.js": "0.8.26"
},
"devDependencies": {
"#ionic/app-scripts": "^3.2.1",
"#ionic/lab": "1.0.18",
"typescript": "~2.6.2"
},
"description": "app description",
"cordova": {
"plugins": {
"cordova-plugin-admob-free": {},
"cordova-plugin-x-socialsharing": {
"ANDROID_SUPPORT_V4_VERSION": "24.1.1+"
},
"cordova-instagram-plugin": {},
"cordova-plugin-network-information": {},
"cordova-plugin-camera": {},
"cordova-plugin-file-transfer": {},
"cordova-open-native-settings": {},
"cordova-plugin-inappbrowser": {},
"cordova-plugin-youtube-video-player": {},
"cordova-plugin-app-version": {},
"cordova-plugin-whitelist": {},
"cordova-plugin-device": {},
"cordova-plugin-splashscreen": {},
"cordova-plugin-ionic-webview": {},
"cordova-plugin-ionic-keyboard": {},
"phonegap-plugin-barcodescanner": {
"ANDROID_SUPPORT_V4_VERSION": "27.+"
},
"cordova-plugin-file": {},
"cordova-plugin-document-viewer": {},
"cordova-plugin-statusbar": {},
"cordova-plugin-local-notification": {},
"cordova-plugin-firebase": {},
"cordova-universal-clipboard": {},
"cordova-plugin-admobpro": {
"PLAY_SERVICES_VERSION": "16.0.0"
},
"cordova-plugin-facebook4": {
"APP_ID": "appid",
"APP_NAME": "237actu",
"FACEBOOK_HYBRID_APP_EVENTS": "false",
"FACEBOOK_ANDROID_SDK_VERSION": "4.38.1"
},
"cordova-plugin-googleplus": {
"REVERSED_CLIENT_ID": "app reverse client id"
}
},
"platforms": [
"android",
"ios"
]
}
}
And here is an excerpt the content of the app.module.ts file
import { GooglePlus } from '#ionic-native/google-plus';
#NgModule({
declarations: [
MyApp,
HomePage,
],
imports: [
AngularFireModule.initializeApp(config),
BrowserModule,
PdfViewerModule,
HttpClientModule,
IonicImageViewerModule,
NgPipesModule,
MomentModule,
IonicModule.forRoot(MyApp),
IonicStorageModule.forRoot(),
],
bootstrap: [IonicApp],
entryComponents: [
MyApp,
HomePage,
],
providers: [
AngularFireAuth,
GooglePlus,
UserAuthService,
Facebook,
RestClientService,
AdmobFreeService,
StatusBar,
UserserviceProvider,
SplashScreen,
LocalNotifications,
AdMobFree,
SocialSharing,
Instagram,
Network,
Camera,
FileTransfer,
File,
OpenNativeSettings,
SimpleTimer,
InAppBrowser,
YoutubeVideoPlayer,
BarcodeScanner,
AppVersion,
Firebase,
{ provide: ErrorHandler, useClass: IonicErrorHandler }
]
})
Any help ?
thanks in advance.
Add ngx like this:
import { GooglePlus } from '#ionic-native/google-plus/ngx';
Import the plugin in a #NgModule and add it to the list of Providers.
For Angular, the import path should end with /ngx. Angular's change
detection is automatically handled. - https://ionicframework.com/docs/native/
Related
I am trying to run a live reload in the browser as i need to be able to see the camera working but i'm just running into one issue after another.
Command: ionic cordova run browser --livereload
The current error is this:
[ng] An unhandled exception occurred: Job name "..getProjectMetadata"
does not exist.
These errors don't even state where it's coming from, but here is my package... it seems to be related to the build-angular package but no matter what i do it either has the error above or the following depending on what version is used:
Schema validation failed with the following errors: Data path ""
should NOT have additional properties(project)
{
"name": "org.apache.cordova.newapp",
"displayName": "frontend",
"version": "1.0.0",
"description": "A sample Apache Cordova application that responds to the deviceready event.",
"main": "index.js",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
"build-prod": "node --max_old_space_size=5048 ./node_modules/#angular/cli/bin/ng build --prod"
},
"private": true,
"dependencies": {
"#angular/animations": "^10.2.5",
"#angular/cdk": "^8.2.3",
"#angular/common": "^8.2.10",
"#angular/compiler": "^8.2.10",
"#angular/core": "^8.2.10",
"#angular/flex-layout": "^8.0.0-beta.27",
"#angular/forms": "^8.2.14",
"#angular/http": "^7.2.16",
"#angular/material": "^8.2.3",
"#angular/platform-browser": "^8.2.10",
"#angular/platform-browser-dynamic": "^8.2.10",
"#angular/router": "^8.2.10",
"#awesome-cordova-plugins/media-capture": "^5.37.3",
"#ionic/angular-toolkit": "^5.0.3",
"#ionic/core": "^5.8.4",
"#ng-bootstrap/ng-bootstrap": "^5.3.1",
"angular-calendar": "^0.28.28",
"angular-flatpickr": "^3.6.6",
"angular-linky": "^1.2.2",
"angular-password-strength-meter": "^3.0.1",
"angularx-flatpickr": "^6.6.0",
"angularx-social-login": "^3.5.7",
"date-fns": "^2.25.0",
"emoji-js": "^3.6.0",
"flatpickr": "^4.6.9",
"hammerjs": "^2.0.8",
"jquery": "^3.6.0",
"ng-recaptcha": "^7.0.2",
"ng-socket-io": "^0.2.4",
"ng2-file-upload": "^1.4.0",
"ngb-modal": "^2.0.3",
"ngx-emoji-picker": "0.0.2",
"ngx-file-drop": "^10.1.1",
"ngx-image-cropper": "^3.3.5",
"ngx-infinite-scroll": "^9.1.0",
"ngx-lightbox": "^2.5.1",
"ngx-paypal": "^6.2.0",
"ngx-toastr": "^11.3.3",
"ngx-ui-loader": "^8.0.0",
"rxjs": "^6.6.7",
"rxjs-compat": "^6.6.7",
"socket.io-client": "^2.4.0",
"tslib": "^1.14.1",
"ws": "^7.5.5",
"zone.js": "~0.9.1",
"zxcvbn3": "^0.1.1"
},
"devDependencies": {
"#angular-devkit/build-angular": "^13.1.2",
"#angular/cli": "^8.3.29",
"#angular/compiler-cli": "^8.2.10",
"#angular/language-service": "^8.2.10",
"#types/jasmine": "~3.3.8",
"#types/jasminewd2": "^2.0.10",
"#types/node": "~8.9.4",
"codelyzer": "^5.0.0",
"cordova-android": "^9.1.0",
"cordova-browser": "^6.0.0",
"cordova-plugin-device": "2.0.2",
"cordova-plugin-ionic-keyboard": "^2.0.5",
"cordova-plugin-ionic-webview": "^4.0.0",
"cordova-plugin-splashscreen": "5.0.2",
"cordova-plugin-statusbar": "2.4.2",
"cordova-plugin-whitelist": "^1.3.4",
"jasmine-core": "~3.4.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~4.1.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~2.0.1",
"karma-jasmine-html-reporter": "^1.7.0",
"protractor": "~5.4.0",
"ts-node": "~7.0.0",
"tslint": "~5.15.0",
"typescript": "~3.5.3"
},
"keywords": [
"ecosystem:cordova"
],
"author": "Apache Cordova Team",
"license": "Apache-2.0",
"cordova": {
"plugins": {
"cordova-plugin-whitelist": {},
"cordova-plugin-media-capture": {},
"cordova-plugin-statusbar": {},
"cordova-plugin-device": {},
"cordova-plugin-splashscreen": {},
"cordova-plugin-ionic-webview": {},
"cordova-plugin-ionic-keyboard": {}
},
"platforms": [
"android",
"browser"
]
}
}
I'm trying to implement ionic admob plus in my ionic application. But whenever I try to show the ad I get the following error. This error appears both for a banner as an interstitial ad.
ERROR Error: Uncaught (in promise): TypeError: plugin.constructor.getPluginRef is not a function
TypeError: plugin.constructor.getPluginRef is not a function
at checkAvailability (VM2270 vendor.js:50324)
at callCordovaPlugin (VM2270 vendor.js:50417)
at VM2270 vendor.js:50251
at VM2270 vendor.js:50193
at new t (VM2269 polyfills.js:3)
at tryNativePromise (VM2270 vendor.js:50192)
at getPromise (VM2270 vendor.js:50213)
at wrapOtherPromise (VM2270 vendor.js:50250)
at VM2270 vendor.js:50509
at cordova (VM2270 vendor.js:148098)
at c (VM2269 polyfills.js:3)
at new t (VM2269 polyfills.js:3)
at tryNativePromise (VM2270 vendor.js:50192)
at getPromise (VM2270 vendor.js:50213)
at wrapOtherPromise (VM2270 vendor.js:50250)
at VM2270 vendor.js:50509
at cordova (VM2270 vendor.js:148098)
at Banner.show (VM2270 vendor.js:91387)
at MyApp.webpackJsonp.717.MyApp.showAd (VM2271 main.js:2123)
at VM2271 main.js:2139
My code: for a banner ad:
this.adMob.banner.show({
id: {
android: "ca-app-pub-xxxxxxxxxxxxxxxxx/xxxxxxxxxxxxx",
ios: ""
}
});
My code: for an interstitial ad:
this.adMob.interstitial.load({
id: {
android: "ca-app-pub-xxxxxxxxxxxxxxxxx/xxxxxxxxx",
ios: ""
}
}).then(() => this.adMob.interstitial.show())
both android ad keys are correct.
My package.json:
{
"name": "xxxxxxxxxxxx",
"version": "0.0.1",
"author": "Ionic Framework",
"homepage": "http://ionicframework.com/",
"private": true,
"scripts": {
"clean": "ionic-app-scripts clean",
"build": "ionic-app-scripts build",
"lint": "ionic-app-scripts lint",
"ionic:build": "ionic-app-scripts build",
"ionic:serve": "ionic-app-scripts serve"
},
"dependencies": {
"#angular/cli": "^6.2.9",
"#angular/common": "5.0.3",
"#angular/compiler": "5.0.3",
"#angular/compiler-cli": "5.0.3",
"#angular/core": "5.0.3",
"#angular/forms": "5.0.3",
"#angular/http": "5.0.3",
"#angular/platform-browser": "5.0.3",
"#angular/platform-browser-dynamic": "5.0.3",
"#ionic-native/admob-plus": "^5.17.0",
"#ionic-native/camera": "^5.15.1",
"#ionic-native/core": "^5.15.1",
"#ionic-native/device": "^5.15.1",
"#ionic-native/facebook": "^5.15.1",
"#ionic-native/file": "^5.15.1",
"#ionic-native/file-path": "^5.15.1",
"#ionic-native/file-transfer": "^5.15.1",
"#ionic-native/google-plus": "^5.15.1",
"#ionic-native/splash-screen": "^5.15.1",
"#ionic-native/status-bar": "^5.15.1",
"#ionic/lab": "^1.0.13",
"#ionic/pro": "1.0.20",
"#ionic/storage": "^2.2.0",
"cordova-admob-plus": "^0.32.0",
"cordova-android": "7.0.0",
"cordova-plugin-android-permissions": "^1.0.2",
"cordova-plugin-camera": "^4.1.0",
"cordova-plugin-device": "^2.0.3",
"cordova-plugin-facebook4": "^3.2.0",
"cordova-plugin-file": "^6.0.2",
"cordova-plugin-file-transfer": "^1.7.1",
"cordova-plugin-filepath": "^1.5.6",
"cordova-plugin-googleplus": "^7.0.2",
"cordova-plugin-inappbrowser": "^3.1.0",
"cordova-plugin-ionic-keyboard": "^2.2.0",
"cordova-plugin-ionic-webview": "^1.2.1",
"cordova-plugin-splashscreen": "^5.0.3",
"cordova-plugin-statusbar": "^2.4.3",
"cordova-plugin-whitelist": "^1.3.4",
"cordova-plugin-x-socialsharing": "^5.4.3",
"cordova-sqlite-storage": "^2.6.0",
"es6-promise-plugin": "^4.2.2",
"ionic-angular": "3.9.2",
"ionic-long-press": "^1.5.0",
"ionicons": "3.0.0",
"ng2-cordova-oauth": "0.0.6",
"node-sass": "^4.10.0",
"rxjs": "5.5.2",
"sw-toolbox": "3.6.0",
"zone.js": "0.8.18"
},
"devDependencies": {
"#ionic/app-scripts": "3.2.3",
"core-js": "^2.6.4",
"typescript": "^3.1.4"
},
"description": "An Ionic project",
"cordova": {
"plugins": {
"cordova-sqlite-storage": {},
"cordova-plugin-device": {},
"cordova-plugin-splashscreen": {},
"cordova-plugin-ionic-webview": {},
"cordova-plugin-ionic-keyboard": {},
"cordova-plugin-file-transfer": {},
"cordova-plugin-file": {},
"cordova-plugin-android-permissions": {},
"cordova-plugin-inappbrowser": {},
"cordova-plugin-whitelist": {},
"cordova-plugin-googleplus": {
"REVERSED_CLIENT_ID": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"PLAY_SERVICES_VERSION": "11.8.0"
},
"cordova-plugin-facebook4": {
"APP_ID": "xxxxxxxxxxxxxx",
"APP_NAME": "xxxxxx",
"FACEBOOK_ANDROID_SDK_VERSION": "4.38.1"
},
"cordova-plugin-statusbar": {},
"cordova-plugin-camera": {},
"cordova-plugin-filepath": {},
"cordova-admob-plus": {
"APP_ID_ANDROID": "ca-app-pub-xxxxxxxxxxxxx~xxxxxxxxxxxxx",
"PLAY_SERVICES_VERSION": "18.2.0"
}
},
"platforms": [
"android"
]
}
}
Does anyone see what is going wrong?
The problem is that the ionic plugin wrapper is broken and it just won't work. And it seems that it has been like that for a while, so it is not likely that it will be fixed anytime soon.
So, in order to make it work, uninstall everything admob-related:
ionic cordova plugin remove cordova-admob-plus
npm uninstall #ionic-native/admob-plus
Also remove from your code all the imports, instances and calls to the plugin. Then install just the cordova plugin:
cordova plugin add cordova-admob-plus --variable APP_ID_ANDROID=ca-app-pub-xxx~xxx --variable APP_ID_IOS=ca-app-pub-xxx~xxx
In the page that you are using admob on, add this before the #Component declaration:
declare var admob;
This variable will give you access to the plugin. Then you can load the banner like this:
admob.setDevMode(true);
admob.banner.show({
id: {
ios: 'ca-app-pub-xxx~xxx',
},
});
You can read more about this issue here
This is a solution that worked for me since the plugin has changed in 2022. I have the admob-plus-cordova plugin installed like this:
$ ionic cordova plugin add admob-plus-cordova --save --variable APP_ID_ANDROID=ca-app-pub-xxxx~yyyy --variable APP_ID_IOS=ca-app-pub-xxxx~yyyy
But when I used the #ionic-native/admob-plus with this, I also received the above error. I didn't want to use the Cordova plugin directly. So to resolve this, I did this:
npm uninstall #ionic-native/admob-plus
npm install #admob-plus/ionic
And then changed all reference to admob-plus From this:
import { AdMob } from '#ionic-native/admob-plus/ngx';
To This:
import { AdMob } from '#admob-plus/ionic/ngx';
That's it. Also make sure you review the code that shows the ad.
With reference to the documentation of admob plus you should use the package #admob-plus/ionic instead of #ionic-native/admob-plus.
This plugin is maintained by the same people as the cordova-package.
This should be better than directly working with cordova.
I'm trying to install a cordova plugin in my ionic app. But Every time and every plugin I try to install throws an error:
Cannot find module 'UNMET/package.json'
I already have to delete the paths: node_modules, plugins, platforms, www a lot of times.
I run:
npm install
ionic cordova plugin add cordova-plugin-local-notification
ionic cordova platform add android
and I tryied to change the order of this, but the problem don't be solved.
I'm running in a Ubuntu 18, ionic version is 4.8.0, cordova version is 9.0.0, cordova-lib 9.0.1, node version 8.10.0, npm 3.5.2.
I just run this line in terminal:
ionic cordova plugin add cordova-plugin-local-notification
my package json:
{
"name": "project-name",
"version": "0.0.1",
"author": "Ionic Framework",
"homepage": "http://ionicframework.com/",
"private": true,
"scripts": {
"android": "ionic cordova run android",
"start": "ionic-app-scripts serve",
"clean": "ionic-app-scripts clean",
"build": "ionic-app-scripts build",
"lint": "ionic-app-scripts lint",
"buildAndroid": "ionic cordova build android --aot --minifyjs --minifycss"
},
"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/fire": "^5.1.1",
"#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/background-geolocation": "^4.20.0",
"#ionic-native/base64": "^4.20.0",
"#ionic-native/camera": "^4.20.0",
"#ionic-native/core": "~4.18.0",
"#ionic-native/crop": "^4.20.0",
"#ionic-native/facebook": "^4.20.0",
"#ionic-native/geolocation": "^4.20.0",
"#ionic-native/google-plus": "^4.20.0",
"#ionic-native/local-notifications": "^4.20.0",
"#ionic-native/location-accuracy": "^4.20.0",
"#ionic-native/social-sharing": "^4.20.0",
"#ionic-native/splash-screen": "~4.18.0",
"#ionic-native/sqlite": "^4.20.0",
"#ionic-native/status-bar": "~4.18.0",
"#ionic/storage": "2.2.0",
"#mauron85/cordova-plugin-background-geolocation": "3.0.3",
"brmasker-ionic-3": "^1.6.3",
"com-badrit-base64": "^0.2.0",
"cordova-plugin-badge": "^0.8.8",
"cordova-plugin-camera": "^4.0.3",
"cordova-plugin-crop": "^0.4.0",
"cordova-plugin-device": "^2.0.2",
"cordova-plugin-geolocation": "4.0.2",
"cordova-plugin-googleplus": "7.0.2",
"cordova-plugin-ionic-keyboard": "^2.1.3",
"cordova-plugin-ionic-webview": "^3.1.2",
"cordova-plugin-local-notification": "0.9.0-beta.2",
"cordova-plugin-request-location-accuracy": "2.3.0",
"cordova-plugin-splashscreen": "^5.0.2",
"cordova-plugin-statusbar": "^2.4.2",
"cordova-plugin-whitelist": "^1.3.3",
"cordova-plugin-x-socialsharing": "5.4.7",
"cordova-sqlite-storage": "^3.2.0",
"es6-promise-plugin": "4.2.2",
"firebase": "^5.8.4",
"ionic-angular": "3.9.3",
"ionicons": "3.0.0",
"ngx-multilingual": "0.0.3",
"rxjs": "5.5.11",
"sw-toolbox": "3.6.0",
"zone.js": "0.8.29"
},
"devDependencies": {
"#ionic/app-scripts": "3.2.1",
"#ionic/lab": "1.0.20",
"typescript": "~2.6.2"
},
"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-sqlite-storage": {},
"com-badrit-base64": {},
"cordova-plugin-camera": {
"ANDROID_SUPPORT_V4_VERSION": "27.+"
},
"cordova-plugin-crop": {},
"cordova-plugin-mauron85-background-geolocation": {
"GOOGLE_PLAY_SERVICES_VERSION": "11+",
"ANDROID_SUPPORT_LIBRARY_VERSION": "26+",
"ICON": "#mipmap/icon",
"SMALL_ICON": "#mipmap/icon",
"ACCOUNT_NAME": "#string/app_name",
"ACCOUNT_LABEL": "#string/app_name",
"ACCOUNT_TYPE": "$PACKAGE_NAME.account",
"CONTENT_AUTHORITY": "$PACKAGE_NAME"
},
"cordova-plugin-googleplus": {
"PLAY_SERVICES_VERSION": "11.8.0"
},
"cordova-plugin-geolocation": {
"GEOLOCATION_USAGE_DESCRIPTION": "Para pegar as melhores promoções"
},
"cordova-plugin-request-location-accuracy": {
"PLAY_SERVICES_LOCATION_VERSION": "16.+"
},
"cordova-plugin-x-socialsharing": {
"ANDROID_SUPPORT_V4_VERSION": "24.1.1+"
},
"cordova-plugin-local-notification": {}
},
"platforms": [
"android"
]
}
}
But every plugin throw this error.
I just need to install plugins in my app again.
Just update npm and you'll be able to build again :)
I installed cordova power management plugin into my ionic application. Following the usage guidance "https://ionicframework.com/docs/native/power-management#installationenter link description here", I import the class as below:
import { PowerManagement } from '#ionic-native/power-management/ngx';
but, when build this ionic app, got the error:
Cannot find module '#ionic-native/power-management/ngx'
Why this error appears? How to fix it?
I try to import the class with removing the ngx module, then error disappears:
import { PowerManagement } from '#ionic-native/power-management';
my package.json file is:
{
"name": "ionicapp",
"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",
"#angular/router": "^6.1.9",
"#ionic-native/background-geolocation": "^4.16.0",
"#ionic-native/background-mode": "^4.20.0",
"#ionic-native/ble": "^4.12.0",
"#ionic-native/bluetooth-serial": "^4.12.2",
"#ionic-native/camera": "4.3.3",
"#ionic-native/core": "^4.12.2",
"#ionic-native/geolocation": "^4.12.0",
"#ionic-native/google-maps": "^4.12.0",
"#ionic-native/launch-navigator": "^4.15.0",
"#ionic-native/native-storage": "^4.12.0",
"#ionic-native/network": "^4.12.2",
"#ionic-native/network-interface": "^4.12.2",
"#ionic-native/power-management": "^4.20.0",
"#ionic-native/splash-screen": "~4.11.0",
"#ionic-native/sqlite": "^4.12.2",
"#ionic-native/status-bar": "^4.11.0",
"#ionic/storage": "^2.1.3",
"#ngx-translate/core": "8.0.0",
"#ngx-translate/http-loader": "^2.0.0",
"#types/google-maps": "^3.2.0",
"#types/googlemaps": "^3.30.12",
"an": "0.0.8",
"angularfire2": "^5.0.2",
"chart.js": "^2.7.2",
"cordova-android": "7.1.0",
"cordova-plugin-actionsheet": "^2.3.3",
"cordova-plugin-background-mode": "git+https://github.com/tushe/cordova-plugin-background-mode.git",
"cordova-plugin-ble-central": "^1.2.2",
"cordova-plugin-bluetooth-serial": "^0.4.7",
"cordova-plugin-compat": "^1.2.0",
"cordova-plugin-device": "^2.0.2",
"cordova-plugin-dialogs": "^2.0.1",
"cordova-plugin-geolocation": "^4.0.1",
"cordova-plugin-googlemaps": "^2.4.2",
"cordova-plugin-ionic-keyboard": "^2.1.2",
"cordova-plugin-ionic-webview": "^2.1.0",
"cordova-plugin-mauron85-background-geolocation": "^3.0.0-alpha.43",
"cordova-plugin-nativestorage": "^2.3.2",
"cordova-plugin-network-information": "^2.0.1",
"cordova-plugin-networkinterface": "^2.0.0",
"cordova-plugin-powermanagement-orig": "^1.1.2",
"cordova-plugin-splashscreen": "^5.0.2",
"cordova-plugin-statusbar": "^2.4.2",
"cordova-plugin-whitelist": "^1.3.3",
"cordova-sqlite-storage": "^2.4.0",
"firebase": "^5.5.3",
"ionic-angular": "3.9.2",
"ionic-native": "4.1.1",
"ionicons": "3.0.0",
"ng2-charts": "^1.6.0",
"rxjs": "5.5.11",
"sw-toolbox": "3.6.0",
"uk.co.workingedge.phonegap.plugin.launchnavigator": "^4.2.2",
"zone.js": "0.8.26",
"at.gofg.sportscomputer.powermanagement": "~1.1.2"
},
"devDependencies": {
"#ionic/app-scripts": "^3.2.0",
"#mauron85/cordova-plugin-background-geolocation": "^3.0.0-alpha.4",
"typescript": "~2.6.2"
},
"description": "An Ionic project",
"cordova": {
"plugins": {
"cordova-plugin-ble-central": {},
"cordova-plugin-whitelist": {},
"cordova-plugin-device": {},
"cordova-plugin-splashscreen": {},
"cordova-plugin-ionic-webview": {},
"cordova-plugin-ionic-keyboard": {},
"cordova-plugin-geolocation": {
"GEOLOCATION_USAGE_DESCRIPTION": "To locate you"
},
"cordova-plugin-mauron85-background-geolocation": {
"GOOGLE_PLAY_SERVICES_VERSION": "11+",
"ANDROID_SUPPORT_LIBRARY_VERSION": "23+",
"ALWAYS_USAGE_DESCRIPTION": "App requires background tracking enabled",
"MOTION_USAGE_DESCRIPTION": "App requires motion detection"
},
"cordova-plugin-nativestorage": {},
"cordova-sqlite-storage": {},
"cordova-plugin-statusbar": {},
"cordova-plugin-bluetooth-serial": {},
"cordova-plugin-network-information": {},
"cordova-plugin-networkinterface": {},
"uk.co.workingedge.phonegap.plugin.launchnavigator": {
"OKHTTP_VERSION": "3.+"
},
"cordova-plugin-background-mode": {},
"at.gofg.sportscomputer.powermanagement": {}
},
"platforms": [
"android"
]
}
}
Use ngx if your Angular version is >=6
You seem to be using the wrong plugin version. Correct your error by following the steps mentioned below
Check your project type in ionic.config.json file.
If the type is "ionic-angular", then install 4 version.
ionic cordova plugin add cordova-plugin-powermanagement-orig
npm install #ionic-native/power-management#4
If the type is "angular", then install the latest version
ionic cordova plugin add cordova-plugin-powermanagement-orig
npm install #ionic-native/power-management
Note:
Add ngx at the end of import only if you are using Angular 6 or 6+
import { PowerManagement } from '#ionic-native/power-management/ngx';
if not remove ngx from the import both in app.module.ts and app.component.ts
import { PowerManagement } from '#ionic-native/power-management';
Refencence:https://github.com/ionic-team/ionic/issues/15225#issuecomment-414074074
I have installed:
npm install #ionic-native/core --save
ionic cordova plugin add cordova-plugin-speechrecognition --save
and I can even see it in package.json but when I am adding it in app.module.ts I am getting this error:
Cannot find module '#ionic-native/speech-recognition'
I do not understand what to do, I have removed it and added it many times but nothing is working.
My package.json code is below
{
"name": "quicktask",
"version": "0.0.1",
"author": "Ionic Framework",
"homepage": "http://ionicframework.com/",
"private": true,
"scripts": {
"clean": "ionic-app-scripts clean",
"build": "ionic-app-scripts build",
"lint": "ionic-app-scripts lint",
"ionic:build": "ionic-app-scripts build",
"ionic:serve": "ionic-app-scripts serve"
},
"dependencies": {
"#angular/common": "4.4.4",
"#angular/compiler": "4.4.4",
"#angular/compiler-cli": "4.4.4",
"#angular/core": "4.4.4",
"#angular/forms": "4.4.4",
"#angular/http": "4.4.4",
"#angular/platform-browser": "4.4.4",
"#angular/platform-browser-dynamic": "4.4.4",
"#ionic-native/core": "^4.3.2",
"#ionic-native/firebase": "^4.4.2",
"#ionic-native/in-app-browser": "^4.5.2",
"#ionic-native/splash-screen": "4.3.2",
"#ionic-native/status-bar": "4.3.2",
"#ionic/storage": "^2.0.1",
"cordova-android": "^6.2.3",
"cordova-browser": "5.0.1",
"cordova-plugin-device": "^1.1.4",
"cordova-plugin-firebase": "^0.1.24",
"cordova-plugin-inappbrowser": "^1.7.2",
"cordova-plugin-ionic-webview": "^1.1.11",
"cordova-plugin-speechrecognition": "^1.2.0",
"cordova-plugin-splashscreen": "^4.0.3",
"cordova-plugin-whitelist": "^1.3.1",
"cordova-sqlite-storage": "^2.1.2",
"ionic-angular": "3.8.0",
"ionic-plugin-keyboard": "^2.2.1",
"ionicons": "3.0.0",
"rxjs": "5.4.3",
"sw-toolbox": "3.6.0",
"time-ago-pipe": "^1.2.1",
"zone.js": "0.8.18"
},
"devDependencies": {
"#ionic/app-scripts": "3.0.1",
"typescript": "2.3.4"
},
"description": "An Ionic project",
"cordova": {
"plugins": {
"cordova-plugin-device": {},
"cordova-plugin-ionic-webview": {},
"cordova-plugin-splashscreen": {},
"cordova-plugin-whitelist": {},
"ionic-plugin-keyboard": {},
"cordova-plugin-firebase": {},
"cordova-sqlite-storage": {},
"cordova-plugin-inappbrowser": {},
"cordova-plugin-speechrecognition": {}
},
"platforms": [
"android",
"browser"
]
}
}
As per the docs, here, you will need to run npm install --save #ionic-native/speech-recognition in addition to installing the cordova plugin