Skip to content

java.lang.RuntimeException / Caused by: com.tns.NativeScriptException: #8550

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

Open
saschaarthur opened this issue Apr 23, 2020 · 15 comments
Open

Comments

@saschaarthur
Copy link

saschaarthur commented Apr 23, 2020

Hello,

We have plenty of app crash reports from google play console like this:

java.lang.RuntimeException: 
   at android.app.ActivityThread.handleBindApplication (ActivityThread.java:6209)
   at android.app.ActivityThread.access$1200 (ActivityThread.java:236)
   at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1784)
   at android.os.Handler.dispatchMessage (Handler.java:106)
   at android.os.Looper.loop (Looper.java:214)
   at android.app.ActivityThread.main (ActivityThread.java:7032)
   at java.lang.reflect.Method.invoke (Native Method)
   at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:494)
   at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:965)
Caused by: com.tns.NativeScriptException: 
   at com.tns.Runtime.initNativeScript (Native Method)
   at com.tns.Runtime.init (Runtime.java:627)
   at com.tns.Runtime.init (Runtime.java:601)
   at com.tns.Runtime.initRuntime (Runtime.java:591)
   at com.tns.Runtime.initializeRuntimeWithConfiguration (Runtime.java:566)
   at com.tns.RuntimeHelper.initRuntime (RuntimeHelper.java:163)
   at com.tns.NativeScriptApplication.onCreate (NativeScriptApplication.java:19)
   at android.app.Instrumentation.callApplicationOnCreate (Instrumentation.java:1154)
   at android.app.ActivityThread.handleBindApplication (ActivityThread.java:6204)

Sadly it looks like our code is not even running at this point of time and the framework is not starting up. Our devices are not crashing at all.

How can we trace this down / debug it?

Nativescript 6.4.1

We removed aab builds already, because we had here linking errors: NativeScript/nativescript-dev-webpack#1135

Our app is well tested (on our devices) and we already released it to our customers and we fighting with a lot of framework bugs it seems, which really leads to bad reviews..

@NathanaelA

This comment was marked as abuse.

@saschaarthur
Copy link
Author

saschaarthur commented Apr 23, 2020

  1. theres not really a pattern all versions of android/cpu archs affected.
  2. Yes we using the google play beta programm to test it finally on those devices before we publish the app to our users.

Any further ideas how to track it down?

@anmaitrannguyen
Copy link

Can you list out which plugins are you using in your project?
There is possible that a Worker Crash
NativeScript/android#1602

@saschaarthur
Copy link
Author

# tns plugin
Dependencies:
┌──────────────────────────────────────┬────────────────┐
│ Plugin                               │ Version        │
│ @angular/animations                  │ ~8.2.0         │
│ @angular/cdk                         │ ~8.2.3         │
│ @angular/common                      │ ~8.2.0         │
│ @angular/compiler                    │ ~8.2.0         │
│ @angular/core                        │ ~8.2.0         │
│ @angular/forms                       │ ~8.2.0         │
│ @angular/http                        │ ~8.0.0-beta.10 │
│ @angular/material                    │ ^8.2.3         │
│ @angular/platform-browser            │ ~8.2.0         │
│ @angular/platform-browser-dynamic    │ ~8.2.0         │
│ @angular/router                      │ ~8.2.0         │
│ @nativescript/angular                │ ~8.21.0        │
│ @nativescript/core                   │ ~6.4.2         │
│ @nativescript/theme                  │ ^2.3.3         │
│ @ngx-translate/core                  │ ^12.1.2        │
│ @ngx-translate/http-loader           │ ^4.0.0         │
│ @nstudio/nativescript-snackbar       │ ^1.1.2         │
│ async-mutex                          │ ^0.1.4         │
│ core-js                              │ ^2.6.9         │
│ hammerjs                             │ ^2.0.8         │
│ messageformat                        │ ^2.3.0         │
│ nativescript                         │ ^6.4.1         │
│ nativescript-barcodescanner          │ ^3.4.2         │
│ nativescript-clipboard               │ ^1.2.0         │
│ nativescript-local-notifications     │ ^4.2.0         │
│ nativescript-plugin-firebase         │ ^10.5.0        │
│ nativescript-secure-storage          │ ^2.6.0         │
│ nativescript-ui-listview             │ ~8.0.1         │
│ nativescript-ui-sidedrawer           │ ^8.0.0         │
│ nativescript-websockets              │ ^1.5.5         │
│ ngx-translate-messageformat-compiler │ ^4.6.0         │
│ pako                                 │ ^1.0.11        │
│ reflect-metadata                     │ ~0.1.12        │
│ rxjs                                 │ ~6.4.0         │
│ stacktrace-js                        │ ^2.0.2         │
│ ts-deferred                          │ ^1.0.4         │
│ tslib                                │ 1.10.0         │
│ zone.js                              │ ~0.9.1         │
└──────────────────────────────────────┴────────────────┘
Dev Dependencies:
┌─────────────────────────────────────────┬───────────┐
│ Plugin                                  │ Version   │
│ @angular-devkit/build-angular           │ ~0.803.25 │
│ @angular/cli                            │ ~8.3.25   │
│ @angular/compiler-cli                   │ ~8.2.0    │
│ @biesbjerg/ngx-translate-extract        │ ^4.2.0    │
│ @biesbjerg/ngx-translate-extract-marker │ ^1.0.0    │
│ @fortawesome/fontawesome-free           │ ^5.12.1   │
│ @nativescript/schematics                │ ~1.0.0    │
│ @nativescript/tslint-rules              │ ~0.0.5    │
│ @types/jasmine                          │ ~3.3.8    │
│ @types/jasminewd2                       │ ~2.0.3    │
│ @types/node                             │ ~8.9.4    │
│ codelyzer                               │ ^5.0.0    │
│ jasmine-core                            │ ~3.4.0    │
│ jasmine-spec-reporter                   │ ~4.2.1    │
│ karma                                   │ ~4.1.0    │
│ karma-chrome-launcher                   │ ~2.2.0    │
│ karma-coverage-istanbul-reporter        │ ~2.0.1    │
│ karma-jasmine                           │ ~2.0.1    │
│ karma-jasmine-html-reporter             │ ^1.5.2    │
│ nativescript-dev-webpack                │ ~1.5.1    │
│ node-sass                               │ ^4.13.1   │
│ protractor                              │ ~5.4.3    │
│ stylelint                               │ ^13.2.1   │
│ stylelint-config-standard               │ ^20.0.0   │
│ tns-platform-declarations               │ ~6.4.2    │
│ ts-node                                 │ ~7.0.0    │
│ tslint                                  │ ~5.15.0   │
│ typescript                              │ ~3.5.3    │
└─────────────────────────────────────────┴───────────┘

@anmaitrannguyen
Copy link

I'm trying to debug which can cause this error. From my view, the App is crashing on this line:

StaticConfiguration config = new StaticConfiguration(logger, appName, nativeLibDir, rootDir,
                        appDir, classLoader, dexDir, dexThumb, appConfig, isDebuggable);

                runtime = Runtime.initializeRuntimeWithConfiguration(config);

The dexThumb, dexDir, classLoader and nativeLibDir can be the issues here. I will checking what can cause the crash.

@saschaarthur
Copy link
Author

if theres anything i can support you with let me know, we have an highly crashing build on production with this bug..

@7ammer
Copy link

7ammer commented Apr 27, 2020

I currently have 8,041 reports from the last 14 days :L

I think this is the same issue:
NativeScript/android#1546
To sum it up:

  • Appeared when people jumped to NS6.2 or higher
  • Seems to be happening on Android 9-10.
  • Crashlytics does not show anything.

@7ammer
Copy link

7ammer commented Apr 27, 2020

Hey @NathanaelA,
This is what my reports are showing...

Screenshot 2020-04-27 at 13 15 31

@NathanaelA

This comment was marked as abuse.

@7ammer
Copy link

7ammer commented Apr 28, 2020

Hi @NathanaelA, thank you for actioning this. I appreciate it!

I jumped from 6.0.0 to 6.5.1
I've noted all the version changes in NativeScript/android#1546

@anmaitrannguyen
Copy link

anmaitrannguyen commented Apr 29, 2020

Hi @NathanWalker ,
I have found a crash in the Crashlytics that look like the one in Google Play:

Caused by com.tns.NativeScriptException: Error calling module function 
Cannot compile /data/data/my.app.com/files/app/vendor.js
SyntaxError: Invalid or unexpected token
File: (file:///data/data/my.app.com/files/app/vendor.js:1:355308)

StackTrace: 
require(:1:266)
	at (file:///data/data/my.app.com/files/app/bundle.js:1:85)
	at require(:1:266)


SyntaxError: Invalid or unexpected token
File: (<unknown>:1:265)

StackTrace: 
require(:1:266)
	at (file:///data/data/my.app.com/files/app/bundle.js:1:85)
	at require(:1:266)


SyntaxError: Invalid or unexpected token
       at com.tns.Runtime.runModule(Runtime.java)
       at com.tns.Runtime.runModule(Runtime.java:674)
       at com.tns.Runtime.run(Runtime.java:666)
       at com.tns.NativeScriptApplication.onCreate(NativeScriptApplication.java:21)
       at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1158)
       at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6271)
       at android.app.ActivityThread.access$1200(ActivityThread.java:238)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loop(Looper.java:214)
       at android.app.ActivityThread.main(ActivityThread.java:7099)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:965)

The line in vendor.js:1:355308
;n["ɵLOCALE_DATA"][t]=e;r&&(n["ɵLOCALE_DATA"][t][n["ɵLocaleDataIndex"].ExtraData]=r)}

The line at bundle.js:85
global.webpackJsonp=global.webpackJsonp||[]

This crash happen when we try to upgrade these package:
"nativescript-angular": "8.2.1" => "8.20.3"
"nativescript-dev-webpack": "1.2.0" => "1.4.0"
"tns-core-modules": "6.1.2" => "6.3.1"
"tns-ios": "6.1.1" => "6.3.0"
"tns-android": "6.1.1" => "6.3.0"

We have the Samsung Galaxy A50, the device in the crash list, tried to reproduce this issues, but so far still not get the crash. There must be a special condition to make this crash appear.

@NathanaelA

This comment was marked as abuse.

@saschaarthur
Copy link
Author

saschaarthur commented Apr 29, 2020

Issue:
java.lang.RuntimeException:

no --nolazy flag

Edit:
currently we running with snapshots, we removed them in the next release (which is running through google atm) so we may can say if the issue is inside the snapshots or not..

@PhilippS93
Copy link

Issue:
java.lang.RuntimeException:

no --nolazy flag

Edit:
currently we running with snapshots, we removed them in the next release (which is running through google atm) so we may can say if the issue is inside the snapshots or not..

Was is related?

@saschaarthur
Copy link
Author

Hello,

Hard to say.. what i figured our so far is that "com.tns.NativeScriptException" is a generic exception for 'everything'. There could be plenty of reasons for this. More information you could gather about your case (if you have one) with the "adb log | logcat" console.

So far we disabled everything which is kind of unstable atm:

Plenty of our errors were coming from NativeScript/android#1546 which is solved now.

But sadly we still have some of this "com.tns.NativeScriptException" left, but the rate itself dropped a lot (<1%, compared to before) without all of this features, so i can only suggest you do do the same for the moment.

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

No branches or pull requests

6 participants