6

I'm seeing a very strange issue.

In my code, I have the following condition:

if (Build.VERSION.SDK_INT >= 19)
    myWebView.evaluateJavascript("..."), null);
else
    myWebView.loadUrl("...");

According to the docs, evaluateJavascript should be available from 4.4 (API 19) and up.

Starting from about a couple of weeks ago, I've been getting crashes from multiple users running Kitkat:

java.lang.IllegalStateException: This API not supported on Android 4.3 and earlier
at android.webkit.WebViewClassic.evaluateJavaScript(WebViewClassic.java:2674)
at android.webkit.WebView.evaluateJavascript(WebView.java:905)  

All the users seeing this crash are either running Android 4.4.4, or 4.4.2, both of which should have this method.

The devices range from: Ascend G510, Ascend Y300, p715, PAD1042 and a few other obscure models.

I am quite baffled. I considered simply upping the requirement here to API 21 (lollipop), but that just doesn't seem right. My code should work, unless I'm missing something?

Anyone know what's going on here?

Gil Moshayof
  • 16,053
  • 4
  • 41
  • 54
  • 3
    Related discussion [here](https://groups.google.com/forum/#!topic/ima-sdk/_jlq5qAmqRQ) and [here](https://plus.google.com/102445430941707435245/posts/EM2L7NxibJE). This seems to happen on custom ROMs only, so most probably it's a bug in them. Latest Y300 stock ROM is 4.1.1. – Xavi López Jun 14 '16 at 14:54

0 Answers0