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 :)
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 am using ionic and cordova in my project but am getting the above error, yet when I try to search online, all the solutions include google firebase, yet I am not using anything from firebase. The project has been building successfully but the error just came from now where.
Here is the error:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugGoogleServices'.
> File google-services.json is missing. The Google Services Plugin cannot function without it.
Searched Location:
D:\Projects\Twalako\apps\driver\platforms\android\app\src\nullnull\google-services.json
D:\Projects\Twalako\apps\driver\platforms\android\app\src\debug\google-services.json
D:\Projects\Twalako\apps\driver\platforms\android\app\src\nullnullDebug\google-services.json
D:\Projects\Twalako\apps\driver\platforms\android\app\src\nullnull\debug\google-services.json
D:\Projects\Twalako\apps\driver\platforms\android\app\src\debug\nullnull\google-services.json
D:\Projects\Twalako\apps\driver\platforms\android\app\google-services.json
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
Ionic info
Ionic:
Ionic CLI : 6.12.1 (C:\Users\Evans\AppData\Roaming\npm\node_modules\#ionic\cli)
Ionic Framework : #ionic/angular 5.3.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
Capacitor:
Capacitor CLI : 2.4.0
#capacitor/core : 2.4.0
Cordova:
Cordova CLI : 10.0.0
Cordova Platforms : android 8.0.0
Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.2.1, (and 22 other plugins)
Utility:
cordova-res : 0.15.2
native-run (update available: 1.0.0) : 0.2.8
System:
NodeJS : v14.15.4 (C:\Program Files\nodejs\node.exe)
npm : 6.14.10
OS : Windows 10
package.json
{
"name": "driver",
"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": {
"#agm/core": "^3.0.0-beta.0",
"#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",
"#capacitor/core": "2.4.0",
"#ionic-native/android-permissions": "^5.30.0",
"#ionic-native/app-version": "^5.28.0",
"#ionic-native/badge": "^5.30.0",
"#ionic-native/call-number": "^5.28.0",
"#ionic-native/camera": "^5.28.0",
"#ionic-native/core": "^5.0.0",
"#ionic-native/crop": "^5.28.0",
"#ionic-native/file": "^5.28.0",
"#ionic-native/geolocation": "^5.28.0",
"#ionic-native/google-maps": "^5.5.0",
"#ionic-native/http": "^5.28.0",
"#ionic-native/in-app-browser": "^5.28.0",
"#ionic-native/ionic-webview": "^5.28.0",
"#ionic-native/location-accuracy": "^5.30.0",
"#ionic-native/native-geocoder": "^5.28.0",
"#ionic-native/network": "^5.30.0",
"#ionic-native/sms-retriever": "^5.28.0",
"#ionic-native/splash-screen": "^5.0.0",
"#ionic-native/status-bar": "^5.0.0",
"#ionic/angular": "^5.0.0",
"#ionic/storage": "^2.3.1",
"call-number": "^1.0.1",
"cordova-androidx-build": "^1.0.4",
"cordova-plugin-add-swift-support": "^2.0.2",
"cordova-plugin-advanced-http": "^3.0.1",
"cordova-plugin-android-permissions": "^1.1.2",
"cordova-plugin-app-version": "^0.1.9",
"cordova-plugin-badge": "^0.8.8",
"cordova-plugin-camera": "^4.1.0",
"cordova-plugin-crop": "^0.4.0",
"cordova-plugin-file": "^6.0.2",
"cordova-plugin-geolocation": "^4.0.2",
"cordova-plugin-googlemaps": "git+https://github.com/mapsplugin/cordova-plugin-googlemaps.git#multiple_maps",
"cordova-plugin-inappbrowser": "^4.0.0",
"cordova-plugin-nativegeocoder": "^3.4.1",
"cordova-plugin-network-information": "^2.0.2",
"cordova-plugin-request-location-accuracy": "^2.3.0",
"cordova-plugin-sms-retriever-manager": "^1.0.2",
"cordova-support-android-plugin": "^1.0.2",
"cordova-support-google-services": "^1.4.1",
"cupertino-pane": "git+https://github.com/roman-rr/cupertino-pane.git",
"ionic-selectable": "^4.7.1",
"ng-otp-input": "^1.7.1",
"ngx-ion-simple-mask": "^0.8.8",
"rxjs": "~6.5.5",
"tslib": "^2.0.0",
"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",
"#angular/language-service": "~10.0.0",
"#capacitor/cli": "2.4.0",
"#ionic/angular-toolkit": "^2.3.0",
"#types/googlemaps": "^3.39.13",
"#types/jasmine": "~3.5.0",
"#types/jasminewd2": "~2.0.3",
"#types/node": "^12.11.1",
"codelyzer": "^6.0.0",
"cordova-android": "^8.0.0",
"cordova-plugin-device": "^2.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.3",
"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.5.0",
"protractor": "~7.0.0",
"ts-node": "~8.3.0",
"tslint": "~6.1.0",
"typescript": "~3.9.5"
},
"description": "An Ionic project",
"cordova": {
"plugins": {
"cordova-plugin-whitelist": {},
"cordova-plugin-statusbar": {},
"cordova-plugin-device": {},
"cordova-plugin-splashscreen": {},
"cordova-plugin-ionic-webview": {},
"cordova-plugin-ionic-keyboard": {},
"cordova-plugin-sms-retriever-manager": {
"PLAY_SERVICES_VERSION": "15.0.1"
},
"cordova-plugin-inappbrowser": {},
"cordova-plugin-app-version": {},
"cordova-plugin-camera": {
"ANDROID_SUPPORT_V4_VERSION": "27.+"
},
"cordova-plugin-file": {},
"cordova-plugin-crop": {},
"cordova-plugin-geolocation": {},
"cordova-plugin-nativegeocoder": {},
"mx.ferreyra.callnumber": {},
"cordova-plugin-advanced-http": {},
"cordova-plugin-googlemaps": {},
"cordova-plugin-android-permissions": {},
"cordova-plugin-request-location-accuracy": {
"PLAY_SERVICES_LOCATION_VERSION": "16.+"
},
"cordova-plugin-network-information": {},
"cordova-plugin-badge": {}
},
"platforms": [
"android"
]
}
}
As you are using cordova-support-google-services for Google Play services so you need to add google-service.json file into your root folder.
To get this file logged in into google console (https://console.firebase.google.com/)
Create New Project / Open Existing Project.
Go to Project Setting & Add/Open Android platform.
Download google-service.json file from there.
Screenshot from the google console:
Add downloaded file to your app root directory.
Project view & file on Visual studio:
Hope this will help you to rid out of google service error.
Thanks!
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 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/
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