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

getHtml() didn't work at an Android device with Android 7 #1000

Closed
4 tasks done
Linzh7 opened this issue Oct 6, 2021 · 5 comments
Closed
4 tasks done

getHtml() didn't work at an Android device with Android 7 #1000

Linzh7 opened this issue Oct 6, 2021 · 5 comments
Labels
bug Something isn't working

Comments

@Linzh7
Copy link

Linzh7 commented Oct 6, 2021

Environment

Technology Version
Flutter version 2.5.2
Plugin version 5.3.2
Android version Android 7.1.2
iOS version x
Xcode version x

Device information:
didn't work:
MI 5C, Android 7.1.2, MIUI 11.0.3
OPPO Reno6 5G, Android 11, ColorOS v11.3
did work:
Oneplus 9 plus, Android 11, OxygenOs 11.2.9.9, etc.

Description

Expected behavior:
After launch the website, the button could return the HTML(by getHtml()). Then I am able to process with this data.

Current behavior:
print error messages which point to package:flutter_inappwebview/src/types.dart

from my point of view, it may relate with android version.

Steps to reproduce

  1. create a InAppWebView with controller and set its URL
  2. add a button or something, it will getHtml from the controller
  3. while tap the button, the function will not work as we expect

Stacktrace/Logcat

E/chromium(15721): [ERROR:gl_context_virtual.cc(39)] Trying to make virtual context current without decoder.
W/ContentCatcher(15721): Failed to notify a WebView
D/mali_winsys(15721): EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, egl_color_buffer_format *, EGLBoolean) returns 0x3000
E/flutter (15721): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: type 'Null' is not a subtype of type 'bool'
E/flutter (15721): #0 RendererPriorityPolicy.fromMap (package:flutter_inappwebview/src/types.dart:4595:38)
E/flutter (15721): #1 AndroidInAppWebViewOptions.fromMap (package:flutter_inappwebview/src/in_app_webview/android/in_app_webview_options.dart:422:61)
E/flutter (15721): #2 InAppWebViewGroupOptions.fromMap (package:flutter_inappwebview/src/in_app_webview/in_app_webview_options.dart:72:38)
E/flutter (15721): #3 InAppWebViewController.getOptions (package:flutter_inappwebview/src/in_app_webview/in_app_webview_controller.dart:1555:39)
E/flutter (15721):
E/flutter (15721): #4 InAppWebViewController.getHtml (package:flutter_inappwebview/src/in_app_webview/in_app_webview_controller.dart:945:41)
E/flutter (15721):
E/flutter (15721): #5 _universityWebRouteState.build. (package:xxxx/xxxx/xxxx.dart:97:80)
E/flutter (15721):
E/flutter (15721):

@Linzh7 Linzh7 added the bug Something isn't working label Oct 6, 2021
@github-actions
Copy link

github-actions bot commented Oct 6, 2021

👋 @Linzh7

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!

@And96
Copy link

And96 commented Oct 6, 2021

Simila problem here. GetHTML sometimes works and sometimes not.
In my case, I am on Android 11

@RodXander
Copy link
Contributor

It also happened to me in Android 7.0, however, in Android 11 it worked correctly.
Using var html = await controller.evaluateJavascript(source: "window.document.getElementsByTagName('html')[0].outerHTML;"); worked on both though.

@Linzh7 Linzh7 changed the title cannot getHtml() at an Android device with Android 7 getHtml() didn't work at an Android device with Android 7 Oct 13, 2021
@lefo0755
Copy link

lefo0755 commented Oct 15, 2021

Maybe its the problem, lefo0755@5f96c33 work fine for me

@Linzh7
Copy link
Author

Linzh7 commented Oct 17, 2021

Maybe its the problem, lefo0755@5f96c33 work fine for me

yeah, it does work 4 me 2.
I tried 2 modified the Null with a default value, but Idk why it didn’t work. XD
glad 2 know how 2 fix it, thx my friend : )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants