Android error reporting: error inflating class android.webkit.WebView

The project reported an unexplained error. However, I met this error three months ago, and it was only today that I got away with it.

First of all, what happened to this error

The layout file writes a WebView control, loads it in the activity, and then crashes! Only some lower version mobile phones can work normally.

Looking puzzled, I know one thing, there is no problem without reason, and there is nothing that can not be solved. But in the face of this, I gave up, because sometimes the project time is very tight, even Baidu for a long time can not solve the problem, had to keep the problem. I rebuilt a project.

Solution summary:

1. If you encounter this WebView rendering exception on Android o, add it under the application of manifest:

<meta-data android:name="android.webkit.WebView.EnableSafeBrowsing"
           android:value="true"/>

2. Error in loading WebView:

reason:

Non native app stores will prompt you to update “Android system WebView”. Update is good, that part of the mobile phone brush machine, Google’s own WebView package lost.

3. A foreign brother said (the problem has been solved)

I had same problem and i solved this problem by changing its theme in manifest.

Modify the theme of Applaction.

I changed any attribute in the theme, that is, a color attribute. After completing this topic and modifying, the project can run normally, and the crash problem disappears. My heart is still full of doubts.

Read More: