【发布时间】:2020-03-06 22:47:46
【问题描述】:
我正在尝试使用 Ionic 和 BluetoothLE 插件构建一个 BLE 配置应用程序。但是,当我导入插件时,它给了我一个空白屏幕。我已经更新到 ionic 5,一切都是最新的。我正在尝试通过 android studio 上的 USB 调试模式来构建它。在我添加导入语句之前它工作正常。
我按照文档中的方式导入它import { BluetoothLE } from '@ionic-native/bluetooth-le/ngx';
插件已正确安装,并被识别为要导入的内容。但由于某种原因,它只会让应用程序变砖。
这是 package-lock.json:
"@ionic-native/bluetooth-le": {
"version": "5.22.0",
"resolved": "https://registry.npmjs.org/@ionic-native/bluetooth-le/-/bluetooth-le-5.22.0.tgz",
"integrity": "sha512-evqUuWzhVZZO7znOQvShCYHP8HdElGwnxpWUCYhSGp0YsoacYJUIB7U4LN0Y7azTn3wgMRWT4m7M49Z42ErMXw==",
"requires": {
"@types/cordova": "^0.0.34"
}
另外,这是插件https://ionicframework.com/docs/native/bluetooth-le
在带有离子服务的浏览器上运行它,我在控制台中收到此错误
StaticInjectorError(Platform: core)[HomePage -> BluetoothLE]:
NullInjectorError: No provider for BluetoothLE!
NullInjectorError: StaticInjectorError(AppModule)[HomePage -> BluetoothLE]:
StaticInjectorError(Platform: core)[HomePage -> BluetoothLE]:
NullInjectorError: No provider for BluetoothLE!
at NullInjector.get (core.js:855)
at resolveToken (core.js:17514)
at tryResolveToken (core.js:17440)
at StaticInjector.get (core.js:17266)
at resolveToken (core.js:17514)
at tryResolveToken (core.js:17440)
at StaticInjector.get (core.js:17266)
at resolveNgModuleDep (core.js:30393)
at NgModuleRef_.get (core.js:31578)
at resolveNgModuleDep (core.js:30393)
at resolvePromise (zone-evergreen.js:797)
at resolvePromise (zone-evergreen.js:754)
at zone-evergreen.js:858
at ZoneDelegate.invokeTask (zone-evergreen.js:391)
at Object.onInvokeTask (core.js:39680)
at ZoneDelegate.invokeTask (zone-evergreen.js:390)
at Zone.runTask (zone-evergreen.js:168)
at drainMicroTaskQueue (zone-evergreen.js:559)```
【问题讨论】:
-
你们还想知道什么?这是一个我知之甚少的问题,所以除了我所知道的导致插件导入问题之外,我不确定从哪里开始。
标签: angular ionic-framework bluetooth-lowenergy capacitor