pichillilorenzo / flutter_inappwebview

A Flutter plugin that allows you to add an inline webview, to use a headless webview, and to open an in-app browser window.
https://inappwebview.dev
Apache License 2.0
3.06k stars 1.37k forks source link

Javascript Files with ES2020+ throw error on Android 9 (and below) #2191

Open MobileD3v3l opened 1 week ago

MobileD3v3l commented 1 week ago

Environment

Technology Version
Flutter version 3.22.2
Plugin version 6.0.0
Android version 9.0
iOS version
macOS version
Xcode version
Google Chrome version 66.0.3359.158

Device information:

Description

Expected behavior: On load a web page on Android 9, page would show. Current behavior: Web page with ES2020+ js script don't works (Android 10+ works)

Steps to reproduce

  1. Create a simple app adding a InAppWebview widget
  2. Load a webpage that uses ES"="=+ js files
  3. Nothing shows

Images

Stacktrace/Logcat

I/WebViewFactory(28351): Loading com.google.android.webview version 66.0.3359.158 (code 336015855) I/example_flutte(28351): The ClassLoaderContext is a special shared library. I/cr_LibraryLoader(28351): Time to load native libraries: 2 ms (timestamps 1780-1782) I/chromium(28351): [INFO:library_loader_hooks.cc(36)] Chromium logging enabled: level = 0, default verbosity = 0 I/cr_LibraryLoader(28351): Expected native library version number "66.0.3359.158", actual native library version number "66.0.3359.158" W/cr_ChildProcLH(28351): Create a new ChildConnectionAllocator with package name = com.google.android.webview, sandboxed = true I/cr_BrowserStartup(28351): Initializing chromium process, singleProcess=false I/cr_base (28351): Android Locale: en_US requires .pak files: [] E/chromium(28351): [ERROR:devtools_http_handler.cc(292)] Cannot start http server for devtools. Stop devtools. W/example_flutte(28351): Accessing hidden method Landroid/view/textclassifier/logging/SmartSelectionEventTracker;->(Landroid/content/Context;I)V (light greylist, reflection) W/example_flutte(28351): Accessing hidden method Landroid/view/textclassifier/logging/SmartSelectionEventTracker;->logEvent(Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent;)V (light greylist, reflection) W/example_flutte(28351): Accessing hidden method Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent;->selectionStarted(I)Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent; (light greylist, reflection) W/example_flutte(28351): Accessing hidden method Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent;->selectionModified(II)Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent; (light greylist, reflection) W/example_flutte(28351): Accessing hidden method Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent;->selectionModified(IILandroid/view/textclassifier/TextClassification;)Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent; (light greylist, reflection) W/example_flutte(28351): Accessing hidden method Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent;->selectionModified(IILandroid/view/textclassifier/TextSelection;)Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent; (light greylist, reflection) W/example_flutte(28351): Accessing hidden method Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent;->selectionAction(III)Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent; (light greylist, reflection) W/example_flutte(28351): Accessing hidden method Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent;->selectionAction(IIILandroid/view/textclassifier/TextClassification;)Landroid/view/textclassifier/logging/SmartSelectionEventTracker$SelectionEvent; (light greylist, reflection) I/example_flutte(28351): Rejecting re-init on previously-failed class java.lang.Class: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/webkit/WebViewRenderProcessClient; I/example_flutte(28351): at android.content.pm.PackageInfo androidx.webkit.WebViewCompat.getCurrentWebViewPackage(android.content.Context) (WebViewCompat.java:349) I/example_flutte(28351): at android.webkit.WebViewClient com.pichillilorenzo.flutter_inappwebview_android.webview.in_app_webview.InAppWebView.createWebViewClient(com.pichillilorenzo.flutter_inappwebview_android.in_app_browser.InAppBrowserDelegate) (InAppWebView.java:212) I/example_flutte(28351): at void com.pichillilorenzo.flutter_inappwebview_android.webview.in_app_webview.InAppWebView.prepare() (InAppWebView.java:252) I/example_flutte(28351): at void com.pichillilorenzo.flutter_inappwebview_android.webview.in_app_webview.FlutterWebView.(com.pichillilorenzo.flutter_inappwebview_android.InAppWebViewFlutterPlugin, android.content.Context, java.lang.Object, java.util.HashMap) (FlutterWebView.java:82) I/example_flutte(28351): at io.flutter.plugin.platform.PlatformView com.pichillilorenzo.flutter_inappwebview_android.webview.FlutterWebViewFactory.create(android.content.Context, int, java.lang.Object) (FlutterWebViewFactory.java:67) I/example_flutte(28351): at io.flutter.plugin.platform.PlatformView io.flutter.plugin.platform.PlatformViewsController.createPlatformView(io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$PlatformViewCreationRequest, boolean) (PlatformViewsController.java:523) I/example_flutte(28351): at void io.flutter.plugin.platform.PlatformViewsController$1.createForPlatformViewLayer(io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$PlatformViewCreationRequest) (PlatformViewsController.java:168) I/example_flutte(28351): at void io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.create(io.flutter.plugin.common.MethodCall, io.flutter.plugin.common.MethodChannel$Result) (PlatformViewsChannel.java:105) I/example_flutte(28351): at void io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.onMethodCall(io.flutter.plugin.common.MethodCall, io.flutter.plugin.common.MethodChannel$Result) (PlatformViewsChannel.java:55) I/example_flutte(28351): at void io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(java.nio.ByteBuffer, io.flutter.plugin.common.BinaryMessenger$BinaryReply) (MethodChannel.java:267) I/example_flutte(28351): at void io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(io.flutter.embedding.engine.dart.DartMessenger$HandlerInfo, java.nio.ByteBuffer, int) (DartMessenger.java:292) I/example_flutte(28351): at void io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(java.lang.String, int, io.flutter.embedding.engine.dart.DartMessenger$HandlerInfo, java.nio.ByteBuffer, long) (DartMessenger.java:319) I/example_flutte(28351): at void io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run() (D8$$SyntheticClass:-1) I/example_flutte(28351): at void android.os.Handler.handleCallback(android.os.Message) (Handler.java:873) I/example_flutte(28351): at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:99) I/example_flutte(28351): at void android.os.Looper.loop() (Looper.java:193) I/example_flutte(28351): at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6669) I/example_flutte(28351): at java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[]) (Method.java:-2) I/example_flutte(28351): at void com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run() (RuntimeInit.java:493) I/example_flutte(28351): at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:858) I/example_flutte(28351): Caused by: java.lang.ClassNotFoundException: Didn't find class "android.webkit.WebViewRenderProcessClient" on path: DexPathList[[zip file "/data/app/com.vicensvives.example_flutter-gH6BtwrTOSBYCO7uGDXS4w==/base.apk"],nativeLibraryDirectories=[/data/app/com.vicensvives.example_flutter-gH6BtwrTOSBYCO7uGDXS4w==/lib/arm64, /data/app/com.vicensvives.example_flutter-gH6BtwrTOSBYCO7uGDXS4w==/base.apk!/lib/arm64-v8a, /system/lib64]] I/example_flutte(28351): at java.lang.Class dalvik.system.BaseDexClassLoader.findClass(java.lang.String) (BaseDexClassLoader.java:134) I/example_flutte(28351): at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:379) I/example_flutte(28351): at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:312) I/example_flutte(28351): at android.content.pm.PackageInfo androidx.webkit.WebViewCompat.getCurrentWebViewPackage(android.content.Context) (WebViewCompat.java:349) I/example_flutte(28351): at android.webkit.WebViewClient com.pichillilorenzo.flutter_inappwebview_android.webview.in_app_webview.InAppWebView.createWebViewClient(com.pichillilorenzo.flutter_inappwebview_android.in_app_browser.InAppBrowserDelegate) (InAppWebView.java:212) I/example_flutte(28351): at void com.pichillilorenzo.flutter_inappwebview_android.webview.in_app_webview.InAppWebView.prepare() (InAppWebView.java:252) I/example_flutte(28351): at void com.pichillilorenzo.flutter_inappwebview_android.webview.in_app_webview.FlutterWebView.(com.pichillilorenzo.flutter_inappwebview_android.InAppWebViewFlutterPlugin, android.content.Context, java.lang.Object, java.util.HashMap) (FlutterWebView.java:82) I/example_flutte(28351): at io.flutter.plugin.platform.PlatformView com.pichillilorenzo.flutter_inappwebview_android.webview.FlutterWebViewFactory.create(android.content.Context, int, java.lang.Object) (FlutterWebViewFactory.java:67) I/example_flutte(28351): at io.flutter.plugin.platform.PlatformView io.flutter.plugin.platform.PlatformViewsController.createPlatformView(io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$PlatformViewCreationRequest, boolean) (PlatformViewsController.java:523) I/example_flutte(28351): at void io.flutter.plugin.platform.PlatformViewsController$1.createForPlatformViewLayer(io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$PlatformViewCreationRequest) (PlatformViewsController.java:168) I/example_flutte(28351): at void io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.create(io.flutter.plugin.common.MethodCall, io.flutter.plugin.common.MethodChannel$Result) (PlatformViewsChannel.java:105) I/example_flutte(28351): at void io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.onMethodCall(io.flutter.plugin.common.MethodCall, io.flutter.plugin.common.MethodChannel$Result) (PlatformViewsChannel.java:55) I/example_flutte(28351): at void io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(java.nio.ByteBuffer, io.flutter.plugin.common.BinaryMessenger$BinaryReply) (MethodChannel.java:267) I/example_flutte(28351): at void io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(io.flutter.embedding.engine.dart.DartMessenger$HandlerInfo, java.nio.ByteBuffer, int) (DartMessenger.java:292) I/example_flutte(28351): at void io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(java.lang.String, int, io.flutter.embedding.engine.dart.DartMessenger$HandlerInfo, java.nio.ByteBuffer, long) (DartMessenger.java:319) I/example_flutte(28351): at void io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run() (D8$$SyntheticClass:-1) I/example_flutte(28351): at void android.os.Handler.handleCallback(android.os.Message) (Handler.java:873) I/example_flutte(28351): at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:99) I/example_flutte(28351): at void android.os.Looper.loop() (Looper.java:193) I/example_flutte(28351): at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6669) I/example_flutte(28351): at java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[]) (Method.java:-2) I/example_flutte(28351): at void com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run() (RuntimeInit.java:493) I/example_flutte(28351): at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:858) I/example_flutte(28351): I/example_flutte(28351): Rejecting re-init on previously-failed class java.lang.Class: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/webkit/WebViewRenderProcessClient; I/example_flutte(28351): at android.content.pm.PackageInfo androidx.webkit.WebViewCompat.getCurrentWebViewPackage(android.content.Context) (WebViewCompat.java:349) I/example_flutte(28351): at android.webkit.WebViewClient com.pichillilorenzo.flutter_inappwebview_android.webview.in_app_webview.InAppWebView.createWebViewClient(com.pichillilorenzo.flutter_inappwebview_android.in_app_browser.InAppBrowserDelegate) (InAppWebView.java:212) I/example_flutte(28351): at void com.pichillilorenzo.flutter_inappwebview_android.webview.in_app_webview.InAppWebView.prepare() (InAppWebView.java:252) I/example_flutte(28351): at void com.pichillilorenzo.flutter_inappwebview_android.webview.in_app_webview.FlutterWebView.(com.pichillilorenzo.flutter_inappwebview_android.InAppWebViewFlutterPlugin, android.content.Context, java.lang.Object, java.util.HashMap) (FlutterWebView.java:82) I/example_flutte(28351): at io.flutter.plugin.platform.PlatformView com.pichillilorenzo.flutter_inappwebview_android.webview.FlutterWebViewFactory.create(android.content.Context, int, java.lang.Object) (FlutterWebViewFactory.java:67) I/example_flutte(28351): at io.flutter.plugin.platform.PlatformView io.flutter.plugin.platform.PlatformViewsController.createPlatformView(io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$PlatformViewCreationRequest, boolean) (PlatformViewsController.java:523) I/example_flutte(28351): at void io.flutter.plugin.platform.PlatformViewsController$1.createForPlatformViewLayer(io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$PlatformViewCreationRequest) (PlatformViewsController.java:168) I/example_flutte(28351): at void io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.create(io.flutter.plugin.common.MethodCall, io.flutter.plugin.common.MethodChannel$Result) (PlatformViewsChannel.java:105) I/example_flutte(28351): at void io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.onMethodCall(io.flutter.plugin.common.MethodCall, io.flutter.plugin.common.MethodChannel$Result) (PlatformViewsChannel.java:55) I/example_flutte(28351): at void io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(java.nio.ByteBuffer, io.flutter.plugin.common.BinaryMessenger$BinaryReply) (MethodChannel.java:267) I/example_flutte(28351): at void io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(io.flutter.embedding.engine.dart.DartMessenger$HandlerInfo, java.nio.ByteBuffer, int) (DartMessenger.java:292) I/example_flutte(28351): at void io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(java.lang.String, int, io.flutter.embedding.engine.dart.DartMessenger$HandlerInfo, java.nio.ByteBuffer, long) (DartMessenger.java:319) I/example_flutte(28351): at void io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run() (D8$$SyntheticClass:-1) I/example_flutte(28351): at void android.os.Handler.handleCallback(android.os.Message) (Handler.java:873) I/example_flutte(28351): at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:99) I/example_flutte(28351): at void android.os.Looper.loop() (Looper.java:193) I/example_flutte(28351): at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6669) I/example_flutte(28351): at java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[]) (Method.java:-2) I/example_flutte(28351): at void com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run() (RuntimeInit.java:493) I/example_flutte(28351): at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:858) I/example_flutte(28351): Caused by: java.lang.ClassNotFoundException: Didn't find class "android.webkit.WebViewRenderProcessClient" on path: DexPathList[[zip file "/data/app/com.vicensvives.example_flutter-gH6BtwrTOSBYCO7uGDXS4w==/base.apk"],nativeLibraryDirectories=[/data/app/com.vicensvives.example_flutter-gH6BtwrTOSBYCO7uGDXS4w==/lib/arm64, /data/app/com.vicensvives.example_flutter-gH6BtwrTOSBYCO7uGDXS4w==/base.apk!/lib/arm64-v8a, /system/lib64]] I/example_flutte(28351): at java.lang.Class dalvik.system.BaseDexClassLoader.findClass(java.lang.String) (BaseDexClassLoader.java:134) I/example_flutte(28351): at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:379) I/example_flutte(28351): at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:312) I/example_flutte(28351): at android.content.pm.PackageInfo androidx.webkit.WebViewCompat.getCurrentWebViewPackage(android.content.Context) (WebViewCompat.java:349) I/example_flutte(28351): at android.webkit.WebViewClient com.pichillilorenzo.flutter_inappwebview_android.webview.in_app_webview.InAppWebView.createWebViewClient(com.pichillilorenzo.flutter_inappwebview_android.in_app_browser.InAppBrowserDelegate) (InAppWebView.java:212) I/example_flutte(28351): at void com.pichillilorenzo.flutter_inappwebview_android.webview.in_app_webview.InAppWebView.prepare() (InAppWebView.java:252) I/example_flutte(28351): at void com.pichillilorenzo.flutter_inappwebview_android.webview.in_app_webview.FlutterWebView.(com.pichillilorenzo.flutter_inappwebview_android.InAppWebViewFlutterPlugin, android.content.Context, java.lang.Object, java.util.HashMap) (FlutterWebView.java:82) I/example_flutte(28351): at io.flutter.plugin.platform.PlatformView com.pichillilorenzo.flutter_inappwebview_android.webview.FlutterWebViewFactory.create(android.content.Context, int, java.lang.Object) (FlutterWebViewFactory.java:67) I/example_flutte(28351): at io.flutter.plugin.platform.PlatformView io.flutter.plugin.platform.PlatformViewsController.createPlatformView(io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$PlatformViewCreationRequest, boolean) (PlatformViewsController.java:523) I/example_flutte(28351): at void io.flutter.plugin.platform.PlatformViewsController$1.createForPlatformViewLayer(io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$PlatformViewCreationRequest) (PlatformViewsController.java:168) I/example_flutte(28351): at void io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.create(io.flutter.plugin.common.MethodCall, io.flutter.plugin.common.MethodChannel$Result) (PlatformViewsChannel.java:105) I/example_flutte(28351): at void io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.onMethodCall(io.flutter.plugin.common.MethodCall, io.flutter.plugin.common.MethodChannel$Result) (PlatformViewsChannel.java:55) I/example_flutte(28351): at void io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(java.nio.ByteBuffer, io.flutter.plugin.common.BinaryMessenger$BinaryReply) (MethodChannel.java:267) I/example_flutte(28351): at void io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(io.flutter.embedding.engine.dart.DartMessenger$HandlerInfo, java.nio.ByteBuffer, int) (DartMessenger.java:292) I/example_flutte(28351): at void io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(java.lang.String, int, io.flutter.embedding.engine.dart.DartMessenger$HandlerInfo, java.nio.ByteBuffer, long) (DartMessenger.java:319) I/example_flutte(28351): at void io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run() (D8$$SyntheticClass:-1) I/example_flutte(28351): at void android.os.Handler.handleCallback(android.os.Message) (Handler.java:873) I/example_flutte(28351): at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:99) I/example_flutte(28351): at void android.os.Looper.loop() (Looper.java:193) I/example_flutte(28351): at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6669) I/example_flutte(28351): at java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[]) (Method.java:-2) I/example_flutte(28351): at void com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run() (RuntimeInit.java:493) I/example_flutte(28351): at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:858) I/example_flutte(28351): D/InAppWebView(28351): Using InAppWebViewClient implementation

github-actions[bot] commented 1 week ago

👋 @MobileD3v3l

NOTE: This comment is auto-generated.

Are you sure you have already searched for the same problem?

Some people open new issues but they didn't search for something similar or for the same issue. Please, search for it using the GitHub issue search box or on the official inappwebview.dev website, or, also, using Google, StackOverflow, etc. before posting a new one. You may already find an answer to your problem!

If this is really a new issue, then thank you for raising it. I will investigate it and get back to you as soon as possible. Please, make sure you have given me as much context as possible! Also, if you didn't already, post a code example that can replicate this issue.

In the meantime, you can already search for some possible solutions online! Because this plugin uses native WebView, you can search online for the same issue adding android WebView [MY ERROR HERE] or ios WKWebView [MY ERROR HERE] keywords.

Following these steps can save you, me, and other people a lot of time, thanks!