IllegalStateException: reasonPhrase can't be empty with Android WebView : <p>I've recently been noticing that a number of users are receiving this <code>IllegalStateException</code>, which causes a crash of the app. It happens when a <code>WebView</code> is shown to the user:</p>

<pre><code>Fatal Exception: java.lang.IllegalArgumentException: reasonPhrase can't be empty.
       at android.webkit.WebResourceResponse.setStatusCodeAndReasonPhrase + 129(WebResourceResponse.java:129)
       at android.webkit.WebResourceResponse.(WebResourceResponse.java:70)
       at jY.a + 308(jY.java:308)
       at zn.handleMessage + 67(zn.java:67)
       at android.os.Handler.dispatchMessage + 102(Handler.java:102)
       at android.os.Looper.loop + 211(Looper.java:211)
       at android.app.ActivityThread.main + 5373(ActivityThread.java:5373)
       at java.lang.reflect.Method.invoke(Method.java)
       at java.lang.reflect.Method.invoke + 372(Method.java:372)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run + 1020(ZygoteInit.java:1020)
       at com.android.internal.os.ZygoteInit.main + 815(ZygoteInit.java:815)
</code></pre>

<p>This crash is not happening for every user. I have tried asking users to update Chrome in the hope that it updates Chromium and also asking them to install the latest version of the Android System WebView but neither gave me any success. Has anyone come across this and know how to fix this? I can't even replicate it myself personally.</p>

<p>I also found this bug log here:
<a href="https://bugs.chromium.org/p/chromium/issues/detail?id=925887" rel="noreferrer">https://bugs.chromium.org/p/chromium/issues/detail?id=925887</a></p>

<p>I've also looked at the source code and can see that the relevant crash is being caused by <code>line 154</code>:
<a href="https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/webkit/WebResourceResponse.java" rel="noreferrer">https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/webkit/WebResourceResponse.java</a></p>

<p>The weird thing is that this supposedly should only happen when an error happens, but I can see that the <code>WebView</code> correctly loads for the user from screenshots and then the app crashes shortly after. Any help would be greatly appreciated!</p>
