nstudio / nativescript-plugins

@nstudio/nativescript-* plugin workspace.
Apache License 2.0
52 stars 40 forks source link

[nativescript-barcodescanner] [Android] blank page in release mode #93

Open ptomasini opened 2 years ago

ptomasini commented 2 years ago

I've a very strange problem:

1- created new test application with:

ns create --template @nativescript/template-drawer-navigation-ng

2- installed plugin:

npm install @nstudio/nativescript-barcodescanner

3 - modified home.component.ts

import { BarcodeScanner} from "@nstudio/nativescript-barcodescanner";

  CameraScan(): void {
    var barcodescanner = new BarcodeScanner;
  }

Compiling and installing in debug mode (tns run android --device XYZ) the home page is displayed. Compiling and installing in release mode (tns run android --device XYZ --release --key-store....) the home page is displayed blank.

No error, no crash, no log error. The page is simply blank.

Commenting out the line with BarcodeScanner reference

  CameraScan(): void {
    // var barcodescanner = new BarcodeScanner;
  }

the home page is display as expected.

package.js

{
  "name": "TestScannerApp",
  "main": "src/main.ts",
  "version": "1.0.0",
  "private": true,
  "dependencies": {
    "@angular/animations": "~13.2.0",
    "@angular/common": "~13.2.0",
    "@angular/compiler": "~13.2.0",
    "@angular/core": "~13.2.0",
    "@angular/forms": "~13.2.0",
    "@angular/platform-browser": "~13.2.0",
    "@angular/platform-browser-dynamic": "~13.2.0",
    "@angular/router": "~13.2.0",
    "@nativescript/angular": "^13.0.0",
    "@nativescript/core": "~8.2.0",
    "@nativescript/theme": "~3.0.2",
    "@nstudio/nativescript-barcodescanner": "^5.0.1",
    "nativescript-ui-sidedrawer": "~10.0.2",
    "rxjs": "~7.5.0",
    "zone.js": "~0.11.5"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~13.2.0",
    "@angular/compiler-cli": "~13.2.0",
    "@nativescript/android": "8.2.2",
    "@nativescript/types": "~8.2.0",
    "@nativescript/webpack": "~5.0.6",
    "@ngtools/webpack": "~13.2.0",
    "typescript": "~4.5.5"
  }
}

Physical device is Android 8.0.0.

Any Idea how to solve?

andrewm-mitchells commented 1 year ago

I'm also seeing this issue in production release. Works fine while in dev/debuggon mode. Below is an error from release build:

JS: CONSOLE ERROR: ERROR Error: Uncaught (in promise): TypeError: Cannot read properties of undefined (reading 'content')
  JS: TypeError: Cannot read properties of undefined (reading 'content')
  JS:     at 82928 (file:///data/data/com.myApp.app/files/app/vendor.js:2:911393)
  JS:     at __webpack_require__ (file:///data/data/com.myApp.app/files/app/runtime.js:1:197)
  JS:     at 79460 (file:///data/data/com.myApp.app/files/app/460.js:1:227)
  JS:     at Function.__webpack_require__ (file:///data/data/com.myApp.app/files/app/runtime.js:1:197)
  JS:     at _ZoneDelegate.invoke (file:///data/data/com.myApp.app/files/app/vendor.js:2:1506575)
  JS:     at Object.onInvoke (file:///data/data/com.myApp.app/files/app/vendor.js:2:1823124)
  JS:     at _ZoneDelegate.invoke (file:///data/data/com.myApp.app/files/app/vendor.js:2:1506515)
  JS:     at Zone.run (file:///data/data/com.myApp.app/files/app/vendor.js:2:1501922)
  JS:     at file:///data/data/com.myApp.app/files/app/vendor.js:2:1517835
  JS:     at _ZoneDelegate.invo...