phonegap-плагин-сканер штрих-кодов не работает при сборке с помощью команды «cordova build android», но работает при сборке с помощью «ionic cordova build android».

#android #cordova #ionic-framework

Вопрос:

Недавно я обновил свой проект ionic(и все другие зависимости) с ionic 4 до ionic 5. Когда я создаю проект с помощью команды ionic cordova build android, все работает хорошо. Но если я использую команду cordova для сборки Android, сканер штрих-кодов phonegap-плагина не работает. Скорее, он отображает предупреждение о родном языке: попытался вызвать BarcodeScanner.scan, но Cordova недоступна. Обязательно включите cordova.js или запуск в устройстве/симуляторе и ошибка ОШИБКИ Ошибка: Не обнаружена (в обещании): cordova_not_available

Вот мои зависимости.

 "dependencies": {  "@angular/common": "^11.2.14",  "@angular/core": "^11.2.14",  "@angular/forms": "^11.2.14",  "@angular/localize": "^11.2.14",  "@angular/platform-browser": "^11.2.14",  "@angular/platform-browser-dynamic": "^11.2.14",  "@angular/router": "^11.2.14",  "@ionic-native/app-minimize": "^5.12.0",  "@ionic-native/barcode-scanner": "^5.27.0",  "@ionic-native/core": "^5.0.0",  "@ionic-native/email-composer": "^5.33.1",  "@ionic-native/screen-orientation": "^5.26.0",  "@ionic-native/splash-screen": "^5.0.0",  "@ionic-native/status-bar": "^5.0.0",  "@ionic/angular": "^5.6.12",  "@ionic/storage": "^2.2.0",  "@locl/cli": "^1.0.0",  "@ngx-translate/core": "^13.0.0",  "@ngx-translate/http-loader": "^6.0.0",  "@prettier/plugin-xml": "^0.13.0",  "cordova-android": "10.1.0",  "cordova-ios": "5.1.1",  "cordova-plugin-appminimize": "^1.0.1",  "cordova-plugin-email-composer": "^0.9.2",  "cordova-plugin-screen-orientation": "^3.0.2",  "cordova-sqlite-storage": "^3.3.0",  "core-js": "^2.5.4",  "d3": "^5.15.1",  "es6-promise-plugin": "^4.2.2",  "fast-xml-parser": "^3.17.6",  "immutable": "^4.0.0-rc.12",  "leaflet": "^1.6.0",  "lodash-es": "^4.17.15",  "lodash.isplainobject": "^4.0.6",  "phonegap-plugin-barcodescanner": "^8.1.0",  "rxjs": "~6.6.7",  "tslib": "^2.0.0",  "validator": "^12.2.0",  "zone.js": "~0.10.2"  },  "devDependencies": {  "@angular-devkit/architect": "~0.1102.14",  "@angular-devkit/build-angular": "^0.1102.14",  "@angular-devkit/core": "~11.2.14",  "@angular-devkit/schematics": "~11.2.14",  "@angular/cli": "~11.2.14",  "@angular/compiler": "~11.2.14",  "@angular/compiler-cli": "~11.2.14",  "@angular/language-service": "~11.2.14",  "@ionic/angular-toolkit": "^4.0.0",  "@types/d3": "^5.7.2",  "@types/immutable": "^3.8.7",  "@types/jasmine": "~3.6.0",  "@types/jasminewd2": "~2.0.3",  "@types/leaflet": "^1.5.12",  "@types/lodash-es": "^4.17.3",  "@types/node": "^12.11.1",  "codelyzer": "^5.1.2",  "cordova-plugin-androidx-adapter": "^1.1.3",  "cordova-plugin-device": "^2.0.2",  "cordova-plugin-ionic-keyboard": "^2.1.3",  "cordova-plugin-ionic-webview": "^4.1.1",  "cordova-plugin-splashscreen": "^5.0.2",  "cordova-plugin-statusbar": "^2.4.2",  "git-describe": "^4.0.4",  "husky": "^3.0.4",  "jasmine-core": "~3.5.0",  "jasmine-spec-reporter": "~5.0.0",  "karma": "~6.3.4",  "karma-chrome-launcher": "~3.1.0",  "karma-coverage-istanbul-reporter": "~3.0.2",  "karma-jasmine": "~4.0.0",  "karma-jasmine-html-reporter": "^1.5.0",  "karma-jasmine-seed-reporter": "^0.2.0",  "lint-staged": "^8.2.1",  "prettier": "1.18.2",  "protractor": "~7.0.0",  "ts-node": "~7.0.0",  "tslint": "~6.1.0",  "typescript": "~4.0.5"  }