Android Failed To Load Webview Provider: No Webview Installed
Solution 1:
I figured out a probable problem here. As we know that webview has been shipping as a separate app from android 5.0, it may be the case that at the time my view is being inflated, the webview package is being updated by the os and therefore it can't find the webview pacakge for those few moments. I know it's a very borderline case but
- as I can see, the crash is happening on only >= 5.0 devices which support this hypothesis
- it's very hard to believe that all such devices don't have webview installed. As a matter of fact, I tried uninstalling the system and chrome packages from my device but still the app doesn't crash.
So here's what I did (hacky solution but prevents crashes):
try {
// the inflating code that's causing the crash
} catch (Exception e) {
if (e.getMessage() != null && e.getMessage().contains("webview")) {
// If the system failed to inflate this view because of the WebView (which could// be one of several types of exceptions), it likely means that the system WebView// is either not present (unlikely) OR in the process of being updated (also unlikely).// It's unlikely but we have been receiving a lot of crashes.// In this case, show the user a message and finish the activity
}
}
Basically nothing but handling that exception. No rocket science there.
Solution 2:
I faced the same issue in Android 12. I opened the Android System Webiew
in my Play Store app and uninstalled it. After it was uninstalled I enabled it by clicking on the Enable button. That worked for me.
Solution 3:
Please refer to this issue.
Workaround
try {
super.setText(spannableStringBuilder, type);
} catch (Exception e) {
// WebView is not installed in some devices by default, Linkify.MAP_ADDRESSES causes the exception
if (e.getMessage().contains("webview")){
setAutoLinkMask(Linkify.WEB_URLS | Linkify.EMAIL_ADDRESSES | Linkify.PHONE_NUMBERS);
}
super.setText(spannableStringBuilder, type);
}
Solution 4:
My exception is
android.webkit.WebViewFactory$MissingWebViewPackageExceptionFailed to load WebView provider:NoWebViewinstalled
detail stack is:
java.lang.RuntimeException:Unable to start activity ComponentInfo{cn.trinea.android.developertools/a.a.aa}: android.view.InflateException: Binary XML file line #16: Binary XML file line #16: Error inflating class a.a.ab
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2665)
......
android.webkit.WebViewFactory$MissingWebViewPackageException:Failed to load WebView provider: No WebView installed
android.webkit.WebViewFactory.getWebViewContextAndSetProvider(WebViewFactory.java:270)
android.webkit.WebViewFactory.getProviderClass(WebViewFactory.java:330)
android.webkit.WebViewFactory.getProvider(WebViewFactory.java:194)
android.webkit.WebView.getFactory(WebView.java:2325)
android.webkit.WebView.ensureProviderCreated(WebView.java:2320)
android.webkit.WebView.setOverScrollMode(WebView.java:2379)
android.view.View.<init>(View.java:4023)
android.view.View.<init>(View.java:4146)
android.view.ViewGroup.<init>(ViewGroup.java:579)
android.widget.AbsoluteLayout.<init>(AbsoluteLayout.java:55)
android.webkit.WebView.<init>(WebView.java:627)
android.webkit.WebView.<init>(WebView.java:572)
android.webkit.WebView.<init>(WebView.java:555)
android.webkit.WebView.<init>(WebView.java:542)
solution is
publicclassMyWebViewextendsWebView {
@OverridepublicvoidsetOverScrollMode(int mode) {
try {
super.setOverScrollMode(mode);
} catch (Exception e) {
if (e.getMessage() != null && e.getMessage().contains("Failed to load WebView provider: No WebView installed")) {
e.printStackTrace();
} else {
throw e;
}
}
}
}
Solution 5:
According to the TextView's sourceCode
if (mAutoLinkMask != 0) {
...
if (Linkify.addLinks(s2, mAutoLinkMask)) {
...
}
}
The textview with android:autoLink
property will call Linkify.addLinks
(reaches the method of WebView
finally) and cause the crash.
So, we can remove the android:autoLink
property and realize with other way to fix the problem.
Post a Comment for "Android Failed To Load Webview Provider: No Webview Installed"