Я использую в своем приложении Ionic 4 плагин '@ionic-native/bluetooth-serial/ngx'
для связи с термопринтером. Если я скомпилирую исходник для устройства Android с Android 7.1.1, он показывает эту ошибку:
E / Конденсатор / Плагин / Консоль: ОШИБКА Ошибка: Uncaught (в обещании): Ошибка:
StaticInjectorError (AppModule) [Домашняя страница -> BluetoothSerial]:
StaticInjectorError (Платформа: ядро) [Домашняя страница -> BluetoothSerial]:
NullInjectorError: Нет поставщика для BluetoothSerial!
Ошибка: StaticInjectorError (AppModule) [Домашняя страница -> BluetoothSerial]:
StaticInjectorError (Платформа: ядро) [Домашняя страница -> BluetoothSerial]:
NullInjectorError: Нет поставщика для BluetoothSerial!
в NullInjector.push ../ node_modules/@angular/core/fesm5/core.js.NullInjector.get
(http: //localhost/vendor.js:42939:19)
at resolToken (http: //localhost/vendor.js:43184:24)
в tryResolveToken (http: //localhost/vendor.js:43128:16)
at StaticInjector.push ../ node_modules/@angular/core/fesm5/core.js.StaticInjector.get
(http: //localhost/vendor.js:43025:20)
at resolToken (http: //localhost/vendor.js:43184:24)
в tryResolveToken (http: //localhost/vendor.js:43128:16)
at StaticInjector.push ../ node_modules/@angular/core/fesm5/core.js.StaticInjector.get
(http: //localhost/vendor.js:43025:20)
at resolNgModuleDep (http: //localhost/vendor.js:55261:29)
на NgModuleRef_.push ../ node_modules/@angular/core/fesm5/core.js.NgModuleRef_.get
(http: //localhost/vendor.js:55950:16)
at resolNgModuleDep (http: //localhost/vendor.js:55261:29)
Я только импортировал его и добавил параметр в конструктор.
код home.ts:
import { Component } from '@angular/core';
import { BluetoothSerial } from '@ionic-native/bluetooth-serial/ngx';
@Component({
selector: 'app-home',
templateUrl: 'home.page.html',
styleUrls: ['home.page.scss'],
})
export class HomePage {
infoText:string = '';
constructor(private bluetoothSerial: BluetoothSerial) {}
listAllItems()
{
this.infoText = 'Hier werden alle Geräte aufgelistet!!!';
}
isConnected()
{
this.infoText = 'Hier wird angezeigt ob es verbunden ist!!!';
}
}
Кто-нибудь знает причину ошибки? Спасибо за помощь.