我在本论坛中发现了离子2的这个问题,但该解决方案不适用于离子v.3.20.0。
我遵循此处列出的步骤: https://ionicframework.com/docs/native/file-path/
根据给定的说明进行安装。然后我将插件添加到'app.module.ts'然后我将'Usage'部分的代码添加到我的ts文件中。
我正在Android设备(LG G4)上使用Google Play的Ionic Dev App预览应用程序,因此我可以使用'ionic serve -c'进行实时重新加载。
我在控制台中看到的错误是:
[18:56:16] console.warn:Native:尝试调用FilePath.resolveNativePath,但未安装FilePath插件。> [18:56:16] console.warn:安装FilePath插件:'ionic cordova 插件添加cordova-plugin-filepath' [18:56:16] console.log:plugin_not_installed
有谁知道如何处理这个错误?
更新:package.json
{
"name": "------------",
"version": "0.0.1",
"author": "-------------",
"homepage": "----------------",
"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/background-mode": "^4.5.3",
"@ionic-native/camera": "4.3.3",
"@ionic-native/core": "4.4.0",
"@ionic-native/file-path": "^4.5.3",
"@ionic-native/media": "^4.5.3",
"@ionic-native/music-controls": "^4.5.3",
"@ionic-native/native-audio": "^4.5.3",
"@ionic-native/splash-screen": "4.4.0",
"@ionic-native/status-bar": "4.4.0",
"@ionic-native/streaming-media": "^4.5.3",
"@ionic/storage": "2.1.3",
"@ngx-translate/core": "8.0.0",
"@ngx-translate/http-loader": "^2.0.0",
"com.hutchind.cordova.plugins.streamingmedia": "~0.1.4",
"cordova-browser": "~5.0.3",
"cordova-plugin-background-mode": "git+https://github.com/katzer/cordova-plugin-background-mode.git",
"cordova-plugin-device": "^2.0.1",
"cordova-plugin-file": "^6.0.1",
"cordova-plugin-filepath": "^1.2.0",
"cordova-plugin-ionic-keyboard": "^2.0.5",
"cordova-plugin-ionic-webview": "^1.1.16",
"cordova-plugin-media": "^5.0.2",
"cordova-plugin-music-controls": "^2.1.4",
"cordova-plugin-nativeaudio": "^3.0.9",
"cordova-plugin-splashscreen": "^5.0.2",
"cordova-plugin-streaming-media": "^1.0.2",
"cordova-plugin-whitelist": "^1.3.3",
"ionic-angular": "3.9.2",
"ionicons": "3.0.0",
"rxjs": "5.5.2",
"sw-toolbox": "3.6.0",
"zone.js": "0.8.18"
},
"devDependencies": {
"@ionic/app-scripts": "3.1.8",
"typescript": "2.4.2"
},
"description": "----------------------------",
"cordova": {
"plugins": {
"cordova-plugin-whitelist": {},
"cordova-plugin-device": {},
"cordova-plugin-splashscreen": {},
"cordova-plugin-ionic-webview": {},
"cordova-plugin-ionic-keyboard": {},
"com.hutchind.cordova.plugins.streamingmedia": {},
"cordova-plugin-nativeaudio": {},
"cordova-plugin-background-mode": {},
"cordova-plugin-media": {},
"cordova-plugin-music-controls": {},
"cordova-plugin-filepath": {}
},
"platforms": [
"browser"
]
}
}