Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nativescript-vue, @nstudio/nativescript-barcodescanner, releases crash #120

Open
gnom395 opened this issue Feb 3, 2023 · 2 comments
Open

Comments

@gnom395
Copy link

gnom395 commented Feb 3, 2023

Hello. Clean project nativescript-vue 8.4.0 plugin @nstudio/nativescript-barcodescanner 5.0.1 app crashes on release launch

@kfrahimi
Copy link

I have the same issue using nativescript-angular 8.4.0 with @nstudio/nativescript-barcodescanner 5.0.1 for my app.
It's weird that the app only crashes when I install the apk that I built for release. With ns run android everything works like a charm.

My app.gradle file:


android {
  defaultConfig {
    minSdkVersion 23
    targetSdkVersion 31
    compileSdkVersion 31

    // Version Information
    versionCode 1
    versionName "1.0.0"

    generatedDensities = []
  }

  aaptOptions {
    additionalParameters "--no-version-vectors"
  }
}

package.json file:

{
  "name": "MyApp",
  "main": "./src/main.ts",
  "version": "1.0.0",
  "private": true,
  "dependencies": {
    "@angular/animations": "~15.1.0",
    "@angular/common": "~15.1.0",
    "@angular/compiler": "~15.1.0",
    "@angular/core": "~15.1.0",
    "@angular/forms": "~15.1.0",
    "@angular/platform-browser": "~15.1.0",
    "@angular/platform-browser-dynamic": "~15.1.0",
    "@angular/router": "~15.1.0",
    "@nativescript/angular": "^15.0.0",
    "@nativescript/camera": "^5.0.15",
    "@nativescript/core": "~8.4.0",
    "@nativescript/theme": "~3.0.2",
    "@nstudio/nativescript-barcodescanner": "^5.0.1",
    "@nstudio/nativescript-checkbox": "^2.0.5",
    "nativescript-jsch": "file:nativescript-jsch",
    "nativescript-nmssh": "file:nativescript-nmssh",
    "nativescript-phone": "^2.0.0",
    "rxjs": "~7.6.0",
    "zone.js": "~0.12.0"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~15.1.0",
    "@angular/compiler-cli": "~15.1.0",
    "@nativescript/types": "~8.4.0",
    "@nativescript/webpack": "~5.0.12",
    "@ngtools/webpack": "~15.1.0",
    "typescript": "~4.8.4"
  }
}

The stack trace from my android device (ns device log):

  E AndroidRuntime: java.lang.RuntimeException: Unable to create application com.tns.NativeScriptApplication: com.tns.NativeScriptException: Error calling module function
 E AndroidRuntime: TypeError: Cannot read property 'content' of undefined
 E AndroidRuntime: File: (file:///data/data/com.sample.app/files/app/vendor.js:48829:95)
 E AndroidRuntime:
 E AndroidRuntime: StackTrace:
 E AndroidRuntime: 82928(file:///data/data/com.sample.app/files/app/vendor.js:48829:96)
 E AndroidRuntime: 	at __webpack_require__(file:///data/data/com.sample.app/files/app/runtime.js:23:42)
 E AndroidRuntime: 	at 31624(file:///data/data/com.sample.app/files/app/bundle.js:29:49)
 E AndroidRuntime: 	at __webpack_require__(file:///data/data/com.sample.app/files/app/runtime.js:23:42)
 E AndroidRuntime: 	at __webpack_exec__(file:///data/data/com.sample.app/files/app/bundle.js:1178:39)
 E AndroidRuntime: 	at (file:///data/data/com.sample.app/files/app/bundle.js:1179:116)
 E AndroidRuntime: 	at __webpack_require__.X(file:///data/data/com.sample.app/files/app/runtime.js:102:21)
 E AndroidRuntime: 	at (file:///data/data/com.sample.app/files/app/bundle.js:1179:47)
 E AndroidRuntime: 	at (file:///data/data/com.sample.app/files/app/bundle.js:1184:3)
 E AndroidRuntime: 	at require(:1:266)
 E AndroidRuntime:
 E AndroidRuntime:
 E AndroidRuntime: TypeError: Cannot read property 'content' of undefined
 E AndroidRuntime: 	at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6764)
 E AndroidRuntime: 	at android.app.ActivityThread.-$$Nest$mhandleBindApplication(Unknown Source:0)
 E AndroidRuntime: 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2133)
 E AndroidRuntime: 	at android.os.Handler.dispatchMessage(Handler.java:106)
 E AndroidRuntime: 	at android.os.Looper.loopOnce(Looper.java:201)
 E AndroidRuntime: 	at android.os.Looper.loop(Looper.java:288)
 E AndroidRuntime: 	at android.app.ActivityThread.main(ActivityThread.java:7872)
 E AndroidRuntime: 	at java.lang.reflect.Method.invoke(Native Method)
 E AndroidRuntime: 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
 E AndroidRuntime: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
 E AndroidRuntime: Caused by: com.tns.NativeScriptException: Error calling module function
 E AndroidRuntime: TypeError: Cannot read property 'content' of undefined
 E AndroidRuntime: File: (file:///data/data/com.sample.app/files/app/vendor.js:48829:95)
 E AndroidRuntime:
 E AndroidRuntime: StackTrace:
 E AndroidRuntime: 82928(file:///data/data/com.sample.app/files/app/vendor.js:48829:96)
 E AndroidRuntime: 	at __webpack_require__(file:///data/data/com.sample.app/files/app/runtime.js:23:42)
 E AndroidRuntime: 	at 31624(file:///data/data/com.sample.app/files/app/bundle.js:29:49)
 E AndroidRuntime: 	at __webpack_require__(file:///data/data/com.sample.app/files/app/runtime.js:23:42)
 E AndroidRuntime: 	at __webpack_exec__(file:///data/data/com.sample.app/files/app/bundle.js:1178:39)
 E AndroidRuntime: 	at (file:///data/data/com.sample.app/files/app/bundle.js:1179:116)
 E AndroidRuntime: 	at __webpack_require__.X(file:///data/data/com.sample.app/files/app/runtime.js:102:21)
 E AndroidRuntime: 	at (file:///data/data/com.sample.app/files/app/bundle.js:1179:47)
 E AndroidRuntime: 	at (file:///data/data/com.sample.app/files/app/bundle.js:1184:3)
 E AndroidRuntime: 	at require(:1:266)
 E AndroidRuntime:
 E AndroidRuntime:
 E AndroidRuntime: TypeError: Cannot read property 'content' of undefined
 E AndroidRuntime: 	at com.tns.Runtime.runModule(Native Method)
 E AndroidRuntime: 	at com.tns.Runtime.runModule(Runtime.java:689)
 E AndroidRuntime: 	at com.tns.Runtime.run(Runtime.java:681)
 E AndroidRuntime: 	at com.tns.NativeScriptApplication.onCreate(NativeScriptApplication.java:21)
 E AndroidRuntime: 	at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1277)
 E AndroidRuntime: 	at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6759)

The line in vendor.js where the error occurs:

const LocalBroadcastManagerPackageName = useAndroidX() ? global.androidx.localbroadcastmanager.content: android.support.v4.content;

Any help is appreciated.

@kfrahimi
Copy link

I found a workaround by adding this to my app.gradle file:

dependencies {
    implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.1.0'
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants