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

I get a error when i execute 'controller.addJavaScriptHandler' #62

Closed
YouCii opened this issue Mar 13, 2019 · 9 comments
Closed

I get a error when i execute 'controller.addJavaScriptHandler' #62

YouCii opened this issue Mar 13, 2019 · 9 comments

Comments

@YouCii
Copy link
Contributor

YouCii commented Mar 13, 2019

The log

16:55:18.547 8 info flutter.tools [  +55 ms] W/cr_CrashFileManager( 3396): /data/user/0/com.cns.ecnsflutter/cache/WebView/Crash Reports does not exist or is not a directory
16:55:18.559 9 info flutter.tools [  +10 ms] I/zygote64( 3396): Rejecting re-init on previously-failed class java.lang.Class<com.android.webview.chromium.SafeBrowsingResponseAdapter>: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/webkit/SafeBrowsingResponse;
16:55:18.560 38 info flutter.tools [        ] I/zygote64( 3396): Caused by: java.lang.ClassNotFoundException: Didn't find class "android.webkit.SafeBrowsingResponse" on path: DexPathList[[zip file "/system/app/WebViewGoogle/WebViewGoogle.apk"],nativeLibraryDirectories=[/system/app/WebViewGoogle/lib/arm64, /system/app/WebViewGoogle/WebViewGoogle.apk!/lib/arm64-v8a, /system/lib64, /system/vendor/lib64, /system/lib64, /system/vendor/lib64]]

@YouCii YouCii changed the title I get error when i execute 'webViewController.addJavaScriptHandler(HANDLER_NAME, callback)' I get error when i execute 'controller.addJavaScriptHandler' Mar 13, 2019
@YouCii YouCii changed the title I get error when i execute 'controller.addJavaScriptHandler' I get a error when i execute 'controller.addJavaScriptHandler' Mar 13, 2019
@pichillilorenzo
Copy link
Owner

pichillilorenzo commented Mar 13, 2019

Does the app crash or is just a warning?

You can set safeBrowsingEnabled option to false.

child: InAppWebView(
  initialUrl: "https://flutter.io/",
  initialOptions: {
    "safeBrowsingEnabled": false
  },
)

Otherwise, you can try this: https://stackoverflow.com/a/55025029/4637638

@YouCii
Copy link
Contributor Author

YouCii commented Mar 13, 2019

App won't crash, just the webview doesn't appear.

The solution I found myself is all about safeBrowsingEnabled, but i dont know how to set it.
I think "safeBrowsingEnabled": false will solve the problem. I will try it tomorrow.

Thank you for your patience, because I have asked a lot of questions.

@pichillilorenzo
Copy link
Owner

@YouCii I think the same 👍
Thanks for the support 😄

@YouCii
Copy link
Contributor Author

YouCii commented Mar 14, 2019

Unfortunately, it is different from what we think. It doesn't work😭.

The console is still reporting the error ofCaused by: java.lang.ClassNotFoundException: Didn't find class "android.webkit.SafeBrowsingResponse" on path: DexPathList...

@pichillilorenzo
Copy link
Owner

Can you give me more logs? I cannot reproduce this problem. Also, which version of Android are you using to test this? Maybe there is a problem with that

@YouCii
Copy link
Contributor Author

YouCii commented Mar 18, 2019

Android Version is 8.0.0. And the IPhoneXR simulator with ios-12.1 has the same problem.
Most of the logs are repeated the following sentences:

2019-03-18 09:03:10.672 24362-24362/com.cns.ecnsflutter I/zygote64: Rejecting re-init on previously-failed class java.lang.Class<com.android.webview.chromium.SafeBrowsingResponseAdapter>: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/webkit/SafeBrowsingResponse;
2019-03-18 09:03:10.672 24362-24362/com.cns.ecnsflutter I/zygote64:     at com.android.webview.chromium.WebViewContentsClientAdapter com.android.webview.chromium.WebViewChromiumFactoryProvider.createWebViewContentsClientAdapter(android.webkit.WebView, android.content.Context) (WebViewChromiumFactoryProvider.java:209)
2019-03-18 09:03:10.672 24362-24362/com.cns.ecnsflutter I/zygote64:     at void com.android.webview.chromium.WebViewChromium.init(java.util.Map, boolean) (WebViewChromium.java:63)
2019-03-18 09:03:10.672 24362-24362/com.cns.ecnsflutter I/zygote64:     at void android.webkit.WebView.<init>(android.content.Context, android.util.AttributeSet, int, int, java.util.Map, boolean) (WebView.java:651)
2019-03-18 09:03:10.672 24362-24362/com.cns.ecnsflutter I/zygote64:     at void android.webkit.WebView.<init>(android.content.Context, android.util.AttributeSet, int, int) (WebView.java:581)
2019-03-18 09:03:10.672 24362-24362/com.cns.ecnsflutter I/zygote64:     at void android.webkit.WebView.<init>(android.content.Context, android.util.AttributeSet, int) (WebView.java:564)
2019-03-18 09:03:10.672 24362-24362/com.cns.ecnsflutter I/zygote64:     at void android.webkit.WebView.<init>(android.content.Context, android.util.AttributeSet) (WebView.java:551)
2019-03-18 09:03:10.672 24362-24362/com.cns.ecnsflutter I/zygote64:     at void android.webkit.WebView.<init>(android.content.Context) (WebView.java:541)
2019-03-18 09:03:10.672 24362-24362/com.cns.ecnsflutter I/zygote64:     at void com.pichillilorenzo.flutter_inappbrowser.InAppWebView.InAppWebView.<init>(android.content.Context, java.lang.Object, int, com.pichillilorenzo.flutter_inappbrowser.InAppWebView.InAppWebViewOptions) (InAppWebView.java:92)
2019-03-18 09:03:10.672 24362-24362/com.cns.ecnsflutter I/zygote64:     at void com.pichillilorenzo.flutter_inappbrowser.FlutterWebView.<init>(io.flutter.plugin.common.PluginRegistry$Registrar, int, java.util.HashMap) (FlutterWebView.java:51)
2019-03-18 09:03:10.672 24362-24362/com.cns.ecnsflutter I/zygote64:     at io.flutter.plugin.platform.PlatformView com.pichillilorenzo.flutter_inappbrowser.FlutterWebViewFactory.create(android.content.Context, int, java.lang.Object) (FlutterWebViewFactory.java:29)
2019-03-18 09:03:10.672 24362-24362/com.cns.ecnsflutter I/zygote64:     at void io.flutter.plugin.platform.SingleViewPresentation.onCreate(android.os.Bundle) (SingleViewPresentation.java:130)
2019-03-18 09:03:10.672 24362-24362/com.cns.ecnsflutter I/zygote64:     at void android.app.Dialog.dispatchOnCreate(android.os.Bundle) (Dialog.java:403)
2019-03-18 09:03:10.672 24362-24362/com.cns.ecnsflutter I/zygote64:     at void android.app.Dialog.show() (Dialog.java:302)
2019-03-18 09:03:10.672 24362-24362/com.cns.ecnsflutter I/zygote64:     at void android.app.Presentation.show() (Presentation.java:249)
2019-03-18 09:03:10.672 24362-24362/com.cns.ecnsflutter I/zygote64:     at void io.flutter.plugin.platform.VirtualDisplayController.<init>(android.content.Context, android.hardware.display.VirtualDisplay, io.flutter.plugin.platform.PlatformViewFactory, android.view.Surface, io.flutter.view.TextureRegistry$SurfaceTextureEntry, int, java.lang.Object) (VirtualDisplayController.java:75)
2019-03-18 09:03:10.672 24362-24362/com.cns.ecnsflutter I/zygote64:     at io.flutter.plugin.platform.VirtualDisplayController io.flutter.plugin.platform.VirtualDisplayController.create(android.content.Context, io.flutter.plugin.platform.PlatformViewFactory, io.flutter.view.TextureRegistry$SurfaceTextureEntry, int, int, int, java.lang.Object) (VirtualDisplayController.java:47)
2019-03-18 09:03:10.672 24362-24362/com.cns.ecnsflutter I/zygote64:     at void io.flutter.plugin.platform.PlatformViewsController.createPlatformView(io.flutter.plugin.common.MethodCall, io.flutter.plugin.common.MethodChannel$Result) (PlatformViewsController.java:179)
2019-03-18 09:03:10.672 24362-24362/com.cns.ecnsflutter I/zygote64:     at void io.flutter.plugin.platform.PlatformViewsController.onMethodCall(io.flutter.plugin.common.MethodCall, io.flutter.plugin.common.MethodChannel$Result) (PlatformViewsController.java:118)
2019-03-18 09:03:10.672 24362-24362/com.cns.ecnsflutter I/zygote64:     at void io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(java.nio.ByteBuffer, io.flutter.plugin.common.BinaryMessenger$BinaryReply) (MethodChannel.java:201)
2019-03-18 09:03:10.672 24362-24362/com.cns.ecnsflutter I/zygote64:     at void io.flutter.view.FlutterNativeView$PlatformMessageHandlerImpl.handleMessageFromDart(java.lang.String, byte[], int) (FlutterNativeView.java:188)
2019-03-18 09:03:10.672 24362-24362/com.cns.ecnsflutter I/zygote64:     at void io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(java.lang.String, byte[], int) (FlutterJNI.java:202)
2019-03-18 09:03:10.672 24362-24362/com.cns.ecnsflutter I/zygote64:     at void android.os.MessageQueue.nativePollOnce(long, int) (MessageQueue.java:-2)
2019-03-18 09:03:10.672 24362-24362/com.cns.ecnsflutter I/zygote64:     at android.os.Message android.os.MessageQueue.next() (MessageQueue.java:331)
2019-03-18 09:03:10.672 24362-24362/com.cns.ecnsflutter I/zygote64:     at void android.os.Looper.loop() (Looper.java:149)
2019-03-18 09:03:10.672 24362-24362/com.cns.ecnsflutter I/zygote64:     at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6701)
2019-03-18 09:03:10.672 24362-24362/com.cns.ecnsflutter I/zygote64:     at java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[]) (Method.java:-2)
2019-03-18 09:03:10.672 24362-24362/com.cns.ecnsflutter I/zygote64:     at void com.android.internal.os.Zygote$MethodAndArgsCaller.run() (Zygote.java:246)
2019-03-18 09:03:10.672 24362-24362/com.cns.ecnsflutter I/zygote64:     at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:783)
2019-03-18 09:03:10.672 24362-24362/com.cns.ecnsflutter I/zygote64: Caused by: java.lang.ClassNotFoundException: Didn't find class "android.webkit.SafeBrowsingResponse" on path: DexPathList[[zip file "/system/app/WebViewGoogle/WebViewGoogle.apk"],nativeLibraryDirectories=[/system/app/WebViewGoogle/lib/arm64, /system/app/WebViewGoogle/WebViewGoogle.apk!/lib/arm64-v8a, /system/lib64, /system/vendor/lib64, /system/lib64, /system/vendor/lib64]]
2019-03-18 09:03:10.672 24362-24362/com.cns.ecnsflutter I/zygote64:     at java.lang.Class dalvik.system.BaseDexClassLoader.findClass(java.lang.String) (BaseDexClassLoader.java:93)
2019-03-18 09:03:10.672 24362-24362/com.cns.ecnsflutter I/zygote64:     at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:379)
2019-03-18 09:03:10.672 24362-24362/com.cns.ecnsflutter I/zygote64:     at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:312)
2019-03-18 09:03:10.672 24362-24362/com.cns.ecnsflutter I/zygote64:     at com.android.webview.chromium.WebViewContentsClientAdapter com.android.webview.chromium.WebViewChromiumFactoryProvider.createWebViewContentsClientAdapter(android.webkit.WebView, android.content.Context) (WebViewChromiumFactoryProvider.java:209)
2019-03-18 09:03:10.672 24362-24362/com.cns.ecnsflutter I/zygote64:     at void com.android.webview.chromium.WebViewChromium.init(java.util.Map, boolean) (WebViewChromium.java:63)
2019-03-18 09:03:10.672 24362-24362/com.cns.ecnsflutter I/zygote64:     at void android.webkit.WebView.<init>(android.content.Context, android.util.AttributeSet, int, int, java.util.Map, boolean) (WebView.java:651)
2019-03-18 09:03:10.672 24362-24362/com.cns.ecnsflutter I/zygote64:     at void android.webkit.WebView.<init>(android.content.Context, android.util.AttributeSet, int, int) (WebView.java:581)
2019-03-18 09:03:10.672 24362-24362/com.cns.ecnsflutter I/zygote64:     at void android.webkit.WebView.<init>(android.content.Context, android.util.AttributeSet, int) (WebView.java:564)
2019-03-18 09:03:10.672 24362-24362/com.cns.ecnsflutter I/zygote64:     at void android.webkit.WebView.<init>(android.content.Context, android.util.AttributeSet) (WebView.java:551)
2019-03-18 09:03:10.672 24362-24362/com.cns.ecnsflutter I/zygote64:     at void android.webkit.WebView.<init>(android.content.Context) (WebView.java:541)
2019-03-18 09:03:10.672 24362-24362/com.cns.ecnsflutter I/zygote64:     at void com.pichillilorenzo.flutter_inappbrowser.InAppWebView.InAppWebView.<init>(android.content.Context, java.lang.Object, int, com.pichillilorenzo.flutter_inappbrowser.InAppWebView.InAppWebViewOptions) (InAppWebView.java:92)
2019-03-18 09:03:10.672 24362-24362/com.cns.ecnsflutter I/zygote64:     at void com.pichillilorenzo.flutter_inappbrowser.FlutterWebView.<init>(io.flutter.plugin.common.PluginRegistry$Registrar, int, java.util.HashMap) (FlutterWebView.java:51)
2019-03-18 09:03:10.672 24362-24362/com.cns.ecnsflutter I/zygote64:     at io.flutter.plugin.platform.PlatformView com.pichillilorenzo.flutter_inappbrowser.FlutterWebViewFactory.create(android.content.Context, int, java.lang.Object) (FlutterWebViewFactory.java:29)
2019-03-18 09:03:10.672 24362-24362/com.cns.ecnsflutter I/zygote64:     at void io.flutter.plugin.platform.SingleViewPresentation.onCreate(android.os.Bundle) (SingleViewPresentation.java:130)
2019-03-18 09:03:10.672 24362-24362/com.cns.ecnsflutter I/zygote64:     at void android.app.Dialog.dispatchOnCreate(android.os.Bundle) (Dialog.java:403)
2019-03-18 09:03:10.672 24362-24362/com.cns.ecnsflutter I/zygote64:     at void android.app.Dialog.show() (Dialog.java:302)
2019-03-18 09:03:10.672 24362-24362/com.cns.ecnsflutter I/zygote64:     at void android.app.Presentation.show() (Presentation.java:249)
2019-03-18 09:03:10.672 24362-24362/com.cns.ecnsflutter I/zygote64:     at void io.flutter.plugin.platform.VirtualDisplayController.<init>(android.content.Context, android.hardware.display.VirtualDisplay, io.flutter.plugin.platform.PlatformViewFactory, android.view.Surface, io.flutter.view.TextureRegistry$SurfaceTextureEntry, int, java.lang.Object) (VirtualDisplayController.java:75)
2019-03-18 09:03:10.672 24362-24362/com.cns.ecnsflutter I/zygote64:     at io.flutter.plugin.platform.VirtualDisplayController io.flutter.plugin.platform.VirtualDisplayController.create(android.content.Context, io.flutter.plugin.platform.PlatformViewFactory, io.flutter.view.TextureRegistry$SurfaceTextureEntry, int, int, int, java.lang.Object) (VirtualDisplayController.java:47)
2019-03-18 09:03:10.672 24362-24362/com.cns.ecnsflutter I/zygote64:     at void io.flutter.plugin.platform.PlatformViewsController.createPlatformView(io.flutter.plugin.common.MethodCall, io.flutter.plugin.common.MethodChannel$Result) (PlatformViewsController.java:179)
2019-03-18 09:03:10.672 24362-24362/com.cns.ecnsflutter I/zygote64:     at void io.flutter.plugin.platform.PlatformViewsController.onMethodCall(io.flutter.plugin.common.MethodCall, io.flutter.plugin.common.MethodChannel$Result) (PlatformViewsController.java:118)
2019-03-18 09:03:10.672 24362-24362/com.cns.ecnsflutter I/zygote64:     at void io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(java.nio.ByteBuffer, io.flutter.plugin.common.BinaryMessenger$BinaryReply) (MethodChannel.java:201)
2019-03-18 09:03:10.672 24362-24362/com.cns.ecnsflutter I/zygote64:     at void io.flutter.view.FlutterNativeView$PlatformMessageHandlerImpl.handleMessageFromDart(java.lang.String, byte[], int) (FlutterNativeView.java:188)
2019-03-18 09:03:10.672 24362-24362/com.cns.ecnsflutter I/zygote64:     at void io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(java.lang.String, byte[], int) (FlutterJNI.java:202)
2019-03-18 09:03:10.672 24362-24362/com.cns.ecnsflutter I/zygote64:     at void android.os.MessageQueue.nativePollOnce(long, int) (MessageQueue.java:-2)
2019-03-18 09:03:10.672 24362-24362/com.cns.ecnsflutter I/zygote64:     at android.os.Message android.os.MessageQueue.next() (MessageQueue.java:331)
2019-03-18 09:03:10.672 24362-24362/com.cns.ecnsflutter I/zygote64:     at void android.os.Looper.loop() (Looper.java:149)
2019-03-18 09:03:10.672 24362-24362/com.cns.ecnsflutter I/zygote64:     at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6701)
2019-03-18 09:03:10.672 24362-24362/com.cns.ecnsflutter I/zygote64:     at java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[]) (Method.java:-2)
2019-03-18 09:03:10.672 24362-24362/com.cns.ecnsflutter I/zygote64:     at void com.android.internal.os.Zygote$MethodAndArgsCaller.run() (Zygote.java:246)
2019-03-18 09:03:10.672 24362-24362/com.cns.ecnsflutter I/zygote64:     at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:783)

@YouCii
Copy link
Contributor Author

YouCii commented Mar 20, 2019

any progress?

@YouCii
Copy link
Contributor Author

YouCii commented Mar 22, 2019

Happy news! Happy news!

I successfully got the response from JS using the code you provided at #59 , even though it still report the error log.

@YouCii YouCii closed this as completed Mar 22, 2019
This was referenced Jul 6, 2020
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants