Ionic插件错误:在运行使用本机地理围栏API的应用程序时插入plugin_not_installed

时间:2018-06-18 14:17:57

标签: angular cordova ionic-framework ionic3 android-geofence

我正在创建一个使用geofence native api的应用程序。当我尝试使用ionicDevApp测试设备时,出现以下错误。

plugin_not_installed我的控制台将记录以下警告:

[15:04:03]  console.warn: Native: tried calling Geofence.addOrUpdate, but the Geofence plugin is not installed.
[15:04:03]  console.warn: Install the Geofence plugin: 'ionic cordova plugin add cordova-plugin-geofence'
[15:04:03]  console.log: Geofence failed to add plugin_not_installed

但我已使用以下命令cordova-plugin-geofence

安装了ionic cordova plugin add cordova-plugin-geofence

安装插件后我也运行了npm install --save @ionic-native/geofence,但我仍然遇到同样的错误。

这是我的package.json文件的片段,显示了项目中依赖项的版本。

{
  "name": "geolocation",
  "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": {
    "@agm/core": "^1.0.0-beta.3",
    "@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",
    "@ionic-native/core": "4.7.0",
    "@ionic-native/geofence": "^4.7.0",
    "@ionic-native/geolocation": "^4.7.0",
    "@ionic-native/splash-screen": "4.7.0",
    "@ionic-native/status-bar": "4.7.0",
    "@ionic/storage": "2.1.3",
    "@types/pusher-js": "^4.2.0",
    "body-parser": "^1.18.3",
    "cordova-android": "7.0.0",
    "cordova-ios": "4.5.4",
    "cordova-plugin-add-swift-support": "^1.6.0",
    "cordova-plugin-compat": "^1.2.0",
    "cordova-plugin-device": "^2.0.2",
    "cordova-plugin-geofence": "^0.7.0",
    "cordova-plugin-geolocation": "^4.0.1",
    "cordova-plugin-ionic-keyboard": "^2.1.2",
    "cordova-plugin-ionic-webview": "^1.2.1",
    "cordova-plugin-splashscreen": "^5.0.2",
    "cordova-plugin-whitelist": "^1.3.3",
    "dotenv": "^6.0.0",
    "es6-promise-plugin": "^4.2.2",
    "express": "^4.16.3",
    "ionic-angular": "3.9.2",
    "ionicons": "3.0.0",
    "pusher": "^2.0.0",
    "pusher-js": "^4.2.2",
    "rxjs": "5.5.11",
    "sw-toolbox": "3.6.0",
    "zone.js": "0.8.26"
  },
  "devDependencies": {
    "@ionic/app-scripts": "3.1.10",
    "typescript": "~2.6.2"
  },
  "description": "An Ionic project",
  "cordova": {
     "plugins": {
      "cordova-plugin-geolocation": {
        "GEOLOCATION_USAGE_DESCRIPTION": "To locate you"
      },
      "cordova-plugin-geofence": {},
      "cordova-plugin-whitelist": {},
      "cordova-plugin-device": {},
      "cordova-plugin-splashscreen": {},
      "cordova-plugin-ionic-webview": {},
      "cordova-plugin-ionic-keyboard": {},
      "cordova-plugin-add-swift-support": {}
    },
    "platforms": [
      "android",
      "ios"
    ]
  }
}

1 个答案:

答案 0 :(得分:0)

Cordova-plugin-geofence似乎不是IonicDevApp当前支持的插件列表的一部分:

https://ionicframework.com/docs/pro/devapp/

您需要将应用打包为适当的二进制文件,然后将其安装在Android上;如果您是iOS用户,请使用TestFlight来测试geofence插件。