android: Cannot find runtime for instance=com.tns.gen.android.webkit.WebViewClient_vendor

Environment Ubuntu 20.04 LTS Node.js v14.17.0 Nativescript CLI 7.2.1 Android SDK 30.0.3

package.json

    "@nativescript/angular": "~11.2.0",
    "@nativescript/core": "~7.3.0",
    "@nativescript/firebase": "~11.1.3",
    "@nativescript/local-notifications": "~5.0.3",
    "@nativescript/secure-storage": "~3.0.0",
    "@nativescript/theme": "~3.0.1",
    "@nota/nativescript-webview-ext": "~7.0.4",
    "@nativescript/android": "7.0.1",
    "@nativescript/ios": "6.5.4",

MinSDK 23

To Reproduce Not possible

Expected behavior Should not crash

Sample project Not possible

Describe the bug Started to use the beatiful webview with @nota for more and more things. Sadly im currently fighting with crashes reaching firebase:

Fatal Exception: com.tns.NativeScriptException: Cannot find runtime for instance=com.tns.gen.android.webkit.WebViewClient_vendor_27466_23_n@55feedc
       at com.tns.Runtime.callJSMethod(Runtime.java:1172)
       at com.tns.Runtime.callJSMethod(Runtime.java:1153)
       at com.tns.Runtime.callJSMethod(Runtime.java:1149)
       at com.tns.gen.android.webkit.WebViewClient_vendor_27466_23_n.shouldInterceptRequest(WebViewClient_vendor_27466_23_n.java:67)
       at L7.a(chromium-TrichromeWebViewGoogle.aab-stable-443021033:15)
       at org.chromium.android_webview.AwContentsBackgroundThreadClient.shouldInterceptRequestFromNative(chromium-TrichromeWebViewGoogle.aab-stable-443021033:2)

grafik

Looking at the stack, it seems that the android application is crashing cause of a missing java/script reference.

Sadly im not even sure whos responsible for the crash, thats why i created it here. Is the bug in chromium,@nota or in tns-core?

I tried to look deeper into the cause of this problem. Looking at https://developer.android.com/reference/android/webkit/ServiceWorkerClient i saw plenty of changes in SDK 24, so i tried to raise minSDK to 24, which sadly didnt solve the issue.

Also i dont completly understand exactly when and how this “com.tns.gen.android.webkit.WebViewClient_vendor” is generated. Sometimes (at least on my windows machine) theres multiple of this classes in platforms\android\app\src\main\java\com\tns\gen\android\webkit even with different (version=$1? and sdk=$2?) WebViewClient_vendor_$1_$2 parameters.

Anyone can point me in the right direction what could cause this crashes and how to patch them?

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 1
  • Comments: 21 (9 by maintainers)

Commits related to this issue

Most upvoted comments

@jessorlisa i think your error comes from the fact that setWebViewClient is not called with null on disposeNativeView. Is there any chance you can try ?

@farfromrefug I will try your suggestion immediately and keep you posted! Sorry for the late reply, I was on vacation 🤷🏻‍♀️.

anyone? 😦