我最近升级了Ionic和cordova。现在,当我尝试运行我的离子项目时
ionic cordova run android -c
我收到了
[20:52:04] console.warn: Native: tried calling StatusBar.styleDefault, but Cordova is not available. Make sure to
include cordova.js or run in a device/simulator
[20:52:04] console.warn: Native: tried calling SplashScreen.hide, but Cordova is not available. Make sure to include
cordova.js or run in a device/simulator
[20:52:29] console.warn: Native: tried accessing the GoogleMaps plugin but Cordova is not available. Make sure to
include cordova.js or run in a device/simulator
我删除了android平台并对其进行了读取。
我试过了
<script src="../node_modules/cordova/cordova.js"></script>
<script src="cordova.js"></script>
不确定这是否有帮助,但我的package.json
{
"name": "***",
"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": "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/camera": "^4.5.3",
"@ionic-native/core": "4.4.0",
"@ionic-native/google-maps": "^4.5.3",
"@ionic-native/splash-screen": "4.4.0",
"@ionic-native/status-bar": "4.4.0",
"@ionic/pro": "1.0.16",
"@ionic/storage": "2.1.3",
"angularfire2": "^5.0.0-rc.6",
"cordova-ios": "~4.3.1",
"firebase": "^4.9.1",
"ionic-angular": "3.9.2",
"ionicons": "3.0.0",
"rxjs": "5.5.2",
"sw-toolbox": "3.6.0",
"zone.js": "0.8.18",
"ionic-plugin-keyboard": "~2.2.1",
"cordova-plugin-whitelist": "~1.3.1",
"cordova-plugin-device": "~1.1.4",
"cordova-plugin-splashscreen": "~4.0.1",
"cordova-plugin-ionic-webview": "^1.1.11",
"cordova-plugin-camera": "~2.4.1",
"cordova-plugin-googlemaps": "~2.2.5",
"cordova-android": "~7.0.0"
},
"devDependencies": {
"@ionic/app-scripts": "3.1.8",
"typescript": "2.4.2"
},
"description": "An Ionic project",
"cordova": {
"platforms": [
"ios",
"android"
],
"plugins": {
"ionic-plugin-keyboard": {},
"cordova-plugin-whitelist": {},
"cordova-plugin-device": {},
"cordova-plugin-splashscreen": {},
"cordova-plugin-ionic-webview": {},
"cordova-plugin-camera": {
"CAMERA_USAGE_DESCRIPTION": " ",
"PHOTOLIBRARY_USAGE_DESCRIPTION": " "
},
"cordova-plugin-googlemaps": {
"API_KEY_FOR_ANDROID": "SECRET",
"API_KEY_FOR_IOS": "SECRET"
}
}
} }
我到处寻找,但是在使用run命令时似乎没有人遇到这个问题,我如何让cordova插件工作?
EDIT ***** 这是我输入离子信息时得到的结果
cli packages: (C:\Users\luke_\AppData\Roaming\npm\node_modules)
@ionic/cli-utils : 1.19.1
ionic (Ionic CLI) : 3.19.1
全球套餐:
cordova (Cordova CLI) : 8.0.0
本地包裹:
@ionic/app-scripts : 3.1.8
Cordova Platforms : none
Ionic Framework : ionic-angular 3.9.2
系统:
Android SDK Tools : 25.2.3
Node : v6.11.0
npm : 3.10.10
OS : Windows 10
环境变量:
ANDROID_HOME : D:\Android
其他:
backend : pro