51 votes

Android Échec du chargement du fournisseur de WebView : Aucun WebView n'est installé

Récemment, nous avons commencé à voir cette nouvelle entrée dans nos crashlytics qui dit qu'Android ne peut pas trouver le paquet webview sur l'appareil.

Voici le stacktrace complet (les classes de notre code source ont été remplacées par .... . :

 Fatal Exception: android.view.InflateException: Binary XML file line #139: Binary XML file line #139: Error inflating class <unknown>

Caused by android.view.InflateException: Binary XML file line #139: Error inflating class <unknown>

Caused by java.lang.reflect.InvocationTargetException
       at java.lang.reflect.Constructor.newInstance0(Constructor.java)
       at java.lang.reflect.Constructor.newInstance(Constructor.java:430)
       at android.view.LayoutInflater.createView(LayoutInflater.java:645)
       at g.a.a.a.d.a(SourceFile:211)
       at g.a.a.a.d.a(SourceFile:20)
       at g.a.a.a.d$a.onCreateView(SourceFile:302)
       at android.view.LayoutInflater$FactoryMerger.onCreateView(LayoutInflater.java:189)
       at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:777)
       at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727)
       at android.view.LayoutInflater.rInflate(LayoutInflater.java:858)
       at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
       at android.view.LayoutInflater.rInflate(LayoutInflater.java:861)
       at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
       at android.view.LayoutInflater.rInflate(LayoutInflater.java:861)
       at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
       at android.view.LayoutInflater.rInflate(LayoutInflater.java:861)
       at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
       at android.view.LayoutInflater.inflate(LayoutInflater.java:518)
       at g.a.a.a.d.inflate(SourceFile:60)
       at android.view.LayoutInflater.inflate(LayoutInflater.java:426)
       at android.view.LayoutInflater.inflate(LayoutInflater.java:377)
       at ......(SourceFile:148)
       at ......(SourceFile:119)
       at ......(SourceFile:28)
       at android.support.v4.view.ViewPager.a(SourceFile:1034)
       at android.support.v4.view.ViewPager.a(SourceFile:1182)
       at android.support.v4.view.ViewPager.c(SourceFile:1116)
       at android.support.v4.view.ViewPager.onMeasure(SourceFile:1642)
       at ....(SourceFile:27)
       at android.view.View.measure(View.java:20234)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6249)
       at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1705)
       at android.widget.LinearLayout.measureVertical(LinearLayout.java:797)
       at android.widget.LinearLayout.onMeasure(LinearLayout.java:657)
       at android.view.View.measure(View.java:20234)
       at android.widget.ScrollView.measureChildWithMargins(ScrollView.java:1320)
       at android.widget.FrameLayout.onMeasure(FrameLayout.java:214)
       at android.widget.ScrollView.onMeasure(ScrollView.java:345)
       at android.view.View.measure(View.java:20234)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6249)
       at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1705)
       at android.widget.LinearLayout.measureVertical(LinearLayout.java:797)
       at android.widget.LinearLayout.onMeasure(LinearLayout.java:657)
       at android.view.View.measure(View.java:20234)
       at android.support.v4.view.ViewPager.onMeasure(SourceFile:1658)
       at android.view.View.measure(View.java:20234)
       at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:825)
       at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:511)
       at android.view.View.measure(View.java:20234)
       at android.support.v4.widget.DrawerLayout.onMeasure(SourceFile:1081)
       at android.view.View.measure(View.java:20234)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6249)
       at android.widget.FrameLayout.onMeasure(FrameLayout.java:214)
       at android.support.v7.widget.ContentFrameLayout.onMeasure(SourceFile:139)
       at android.view.View.measure(View.java:20234)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6249)
       at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1705)
       at android.widget.LinearLayout.measureVertical(LinearLayout.java:797)
       at android.widget.LinearLayout.onMeasure(LinearLayout.java:657)
       at android.view.View.measure(View.java:20234)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6249)
       at android.widget.FrameLayout.onMeasure(FrameLayout.java:214)
       at android.view.View.measure(View.java:20234)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6249)
       at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1705)
       at android.widget.LinearLayout.measureVertical(LinearLayout.java:797)
       at android.widget.LinearLayout.onMeasure(LinearLayout.java:657)
       at android.view.View.measure(View.java:20234)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6249)
       at android.widget.FrameLayout.onMeasure(FrameLayout.java:214)
       at com.android.internal.policy.DecorView.onMeasure(DecorView.java:716)
       at android.view.View.measure(View.java:20234)
       at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2659)
       at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1600)
       at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1873)
       at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1485)
       at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7078)
       at android.view.Choreographer$CallbackRecord.run(Choreographer.java:910)
       at android.view.Choreographer.doCallbacks(Choreographer.java:712)
       at android.view.Choreographer.doFrame(Choreographer.java:646)
       at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:896)
       at android.os.Handler.handleCallback(Handler.java:836)
       at android.os.Handler.dispatchMessage(Handler.java:103)
       at android.os.Looper.loop(Looper.java:203)
       at android.app.ActivityThread.main(ActivityThread.java:6369)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1088)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:949)
Caused by android.util.AndroidRuntimeException: android.webkit.WebViewFactory$MissingWebViewPackageException: Failed to load WebView provider: No WebView installed
       at android.webkit.WebViewFactory.getProviderClass(WebViewFactory.java:395)
       at android.webkit.WebViewFactory.getProvider(WebViewFactory.java:194)
       at android.webkit.WebView.getFactory(WebView.java:2592)
       at android.webkit.WebView.findAddress(WebView.java:1958)
       at android.text.util.Linkify.gatherMapLinks(Linkify.java:599)
       at android.text.util.Linkify.addLinks(Linkify.java:287)
       at android.widget.TextView.setText(TextView.java:4474)
       at android.widget.TextView.setText(TextView.java:4395)
       at android.widget.TextView.<init>(TextView.java:1472)
       at android.widget.TextView.<init>(TextView.java:727)
       at android.widget.TextView.<init>(TextView.java:723)
       at me.grantland.widget.AutofitTextView.<init>(SourceFile:25)
       at java.lang.reflect.Constructor.newInstance0(Constructor.java)
       at java.lang.reflect.Constructor.newInstance(Constructor.java:430)
       at android.view.LayoutInflater.createView(LayoutInflater.java:645)
       at g.a.a.a.d.a(SourceFile:211)
       at g.a.a.a.d.a(SourceFile:20)
       at g.a.a.a.d$a.onCreateView(SourceFile:302)
       at android.view.LayoutInflater$FactoryMerger.onCreateView(LayoutInflater.java:189)
       at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:777)
       at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727)
       at android.view.LayoutInflater.rInflate(LayoutInflater.java:858)
       at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
       at android.view.LayoutInflater.rInflate(LayoutInflater.java:861)
       at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
       at android.view.LayoutInflater.rInflate(LayoutInflater.java:861)
       at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
       at android.view.LayoutInflater.rInflate(LayoutInflater.java:861)
       at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
       at android.view.LayoutInflater.inflate(LayoutInflater.java:518)
       at g.a.a.a.d.inflate(SourceFile:60)
       at android.view.LayoutInflater.inflate(LayoutInflater.java:426)
       at android.view.LayoutInflater.inflate(LayoutInflater.java:377)
       at ....(SourceFile:148)
       at ....(SourceFile:119)
       at ....(SourceFile:28)
       at android.support.v4.view.ViewPager.a(SourceFile:1034)
       at android.support.v4.view.ViewPager.a(SourceFile:1182)
       at android.support.v4.view.ViewPager.c(SourceFile:1116)
       at android.support.v4.view.ViewPager.onMeasure(SourceFile:1642)
       at ....(SourceFile:27)
       at android.view.View.measure(View.java:20234)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6249)
       at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1705)
       at android.widget.LinearLayout.measureVertical(LinearLayout.java:797)
       at android.widget.LinearLayout.onMeasure(LinearLayout.java:657)
       at android.view.View.measure(View.java:20234)
       at android.widget.ScrollView.measureChildWithMargins(ScrollView.java:1320)
       at android.widget.FrameLayout.onMeasure(FrameLayout.java:214)
       at android.widget.ScrollView.onMeasure(ScrollView.java:345)
       at android.view.View.measure(View.java:20234)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6249)
       at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1705)
       at android.widget.LinearLayout.measureVertical(LinearLayout.java:797)
       at android.widget.LinearLayout.onMeasure(LinearLayout.java:657)
       at android.view.View.measure(View.java:20234)
       at android.support.v4.view.ViewPager.onMeasure(SourceFile:1658)
       at android.view.View.measure(View.java:20234)
       at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:825)
       at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:511)
       at android.view.View.measure(View.java:20234)
       at android.support.v4.widget.DrawerLayout.onMeasure(SourceFile:1081)
       at android.view.View.measure(View.java:20234)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6249)
       at android.widget.FrameLayout.onMeasure(FrameLayout.java:214)
       at android.support.v7.widget.ContentFrameLayout.onMeasure(SourceFile:139)
       at android.view.View.measure(View.java:20234)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6249)
       at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1705)
       at android.widget.LinearLayout.measureVertical(LinearLayout.java:797)
       at android.widget.LinearLayout.onMeasure(LinearLayout.java:657)
       at android.view.View.measure(View.java:20234)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6249)
       at android.widget.FrameLayout.onMeasure(FrameLayout.java:214)
       at android.view.View.measure(View.java:20234)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6249)
       at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1705)
       at android.widget.LinearLayout.measureVertical(LinearLayout.java:797)
       at android.widget.LinearLayout.onMeasure(LinearLayout.java:657)
       at android.view.View.measure(View.java:20234)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6249)
       at android.widget.FrameLayout.onMeasure(FrameLayout.java:214)
       at com.android.internal.policy.DecorView.onMeasure(DecorView.java:716)
       at android.view.View.measure(View.java:20234)
       at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2659)
       at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1600)
       at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1873)
       at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1485)
       at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7078)
       at android.view.Choreographer$CallbackRecord.run(Choreographer.java:910)
       at android.view.Choreographer.doCallbacks(Choreographer.java:712)
       at android.view.Choreographer.doFrame(Choreographer.java:646)
       at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:896)
       at android.os.Handler.handleCallback(Handler.java:836)
       at android.os.Handler.dispatchMessage(Handler.java:103)
       at android.os.Looper.loop(Looper.java:203)
       at android.app.ActivityThread.main(ActivityThread.java:6369)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1088)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:949)
Caused by android.webkit.WebViewFactory$MissingWebViewPackageException: Failed to load WebView provider: No WebView installed
       at android.webkit.WebViewFactory.getWebViewContextAndSetProvider(WebViewFactory.java:294)
       at android.webkit.WebViewFactory.getProviderClass(WebViewFactory.java:354)
       at android.webkit.WebViewFactory.getProvider(WebViewFactory.java:194)
       at android.webkit.WebView.getFactory(WebView.java:2592)
       at android.webkit.WebView.findAddress(WebView.java:1958)
       at android.text.util.Linkify.gatherMapLinks(Linkify.java:599)
       at android.text.util.Linkify.addLinks(Linkify.java:287)
       at android.widget.TextView.setText(TextView.java:4474)
       at android.widget.TextView.setText(TextView.java:4395)
       at android.widget.TextView.<init>(TextView.java:1472)
       at android.widget.TextView.<init>(TextView.java:727)
       at android.widget.TextView.<init>(TextView.java:723)
       at me.grantland.widget.AutofitTextView.<init>(SourceFile:25)
       at java.lang.reflect.Constructor.newInstance0(Constructor.java)
       at java.lang.reflect.Constructor.newInstance(Constructor.java:430)
       at android.view.LayoutInflater.createView(LayoutInflater.java:645)
       at g.a.a.a.d.a(SourceFile:211)
       at g.a.a.a.d.a(SourceFile:20)
       at g.a.a.a.d$a.onCreateView(SourceFile:302)
       at android.view.LayoutInflater$FactoryMerger.onCreateView(LayoutInflater.java:189)
       at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:777)
       at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727)
       at android.view.LayoutInflater.rInflate(LayoutInflater.java:858)
       at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
       at android.view.LayoutInflater.rInflate(LayoutInflater.java:861)
       at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
       at android.view.LayoutInflater.rInflate(LayoutInflater.java:861)
       at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
       at android.view.LayoutInflater.rInflate(LayoutInflater.java:861)
       at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
       at android.view.LayoutInflater.inflate(LayoutInflater.java:518)
       at g.a.a.a.d.inflate(SourceFile:60)
       at android.view.LayoutInflater.inflate(LayoutInflater.java:426)
       at android.view.LayoutInflater.inflate(LayoutInflater.java:377)
       at ....(SourceFile:148)
       at ....(SourceFile:119)
       at ....(SourceFile:28)
       at android.support.v4.view.ViewPager.a(SourceFile:1034)
       at android.support.v4.view.ViewPager.a(SourceFile:1182)
       at android.support.v4.view.ViewPager.c(SourceFile:1116)
       at android.support.v4.view.ViewPager.onMeasure(SourceFile:1642)
       at ....(SourceFile:27)
       at android.view.View.measure(View.java:20234)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6249)
       at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1705)
       at android.widget.LinearLayout.measureVertical(LinearLayout.java:797)
       at android.widget.LinearLayout.onMeasure(LinearLayout.java:657)
       at android.view.View.measure(View.java:20234)
       at android.widget.ScrollView.measureChildWithMargins(ScrollView.java:1320)
       at android.widget.FrameLayout.onMeasure(FrameLayout.java:214)
       at android.widget.ScrollView.onMeasure(ScrollView.java:345)
       at android.view.View.measure(View.java:20234)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6249)
       at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1705)
       at android.widget.LinearLayout.measureVertical(LinearLayout.java:797)
       at android.widget.LinearLayout.onMeasure(LinearLayout.java:657)
       at android.view.View.measure(View.java:20234)
       at android.support.v4.view.ViewPager.onMeasure(SourceFile:1658)
       at android.view.View.measure(View.java:20234)
       at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:825)
       at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:511)
       at android.view.View.measure(View.java:20234)
       at android.support.v4.widget.DrawerLayout.onMeasure(SourceFile:1081)
       at android.view.View.measure(View.java:20234)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6249)
       at android.widget.FrameLayout.onMeasure(FrameLayout.java:214)
       at android.support.v7.widget.ContentFrameLayout.onMeasure(SourceFile:139)
       at android.view.View.measure(View.java:20234)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6249)
       at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1705)
       at android.widget.LinearLayout.measureVertical(LinearLayout.java:797)
       at android.widget.LinearLayout.onMeasure(LinearLayout.java:657)
       at android.view.View.measure(View.java:20234)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6249)
       at android.widget.FrameLayout.onMeasure(FrameLayout.java:214)
       at android.view.View.measure(View.java:20234)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6249)
       at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1705)
       at android.widget.LinearLayout.measureVertical(LinearLayout.java:797)
       at android.widget.LinearLayout.onMeasure(LinearLayout.java:657)
       at android.view.View.measure(View.java:20234)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6249)
       at android.widget.FrameLayout.onMeasure(FrameLayout.java:214)
       at com.android.internal.policy.DecorView.onMeasure(DecorView.java:716)
       at android.view.View.measure(View.java:20234)
       at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2659)
       at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1600)
       at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1873)
       at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1485)
       at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7078)
       at android.view.Choreographer$CallbackRecord.run(Choreographer.java:910)
       at android.view.Choreographer.doCallbacks(Choreographer.java:712)
       at android.view.Choreographer.doFrame(Choreographer.java:646)
       at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:896)
       at android.os.Handler.handleCallback(Handler.java:836)
       at android.os.Handler.dispatchMessage(Handler.java:103)
       at android.os.Looper.loop(Looper.java:203)
       at android.app.ActivityThread.main(ActivityThread.java:6369)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1088)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:949)

Nous le constatons sur :

Versions Android : 5,6,7

Fabricants d'appareils : Lenovo, oneplus, samsung, motorola

Et, les appareils ne sont pas enracinés.

Après avoir cherché pendant un certain temps, je ne suis pas en mesure de trouver une cause (et un traitement) appropriée pour cela. J'ai parcouru ce question également mais il n'y a pas de solution.

Aidez-moi, s'il vous plaît.

Edit : Cela arrive pour beaucoup de nos utilisateurs, donc je ne peux pas aller dire à tout le monde de vérifier/installer webiew depuis le play store. Y a-t-il une meilleure solution pour cela ?

42voto

Yash Points 286

J'ai trouvé un problème probable ici. Comme nous savons que webview a été expédié comme une application séparée depuis Android 5.0, il se peut que au moment où ma vue est gonflée, le paquet de webview est mis à jour par le système d'exploitation et donc il ne peut pas trouver le paquet de webview pendant ces quelques instants. . Je sais que c'est un cas très limite mais

  • Comme je peux le constater, le crash se produit uniquement sur les appareils >= 5.0, ce qui confirme cette hypothèse.
  • il est très difficile de croire que tous ces appareils n'ont pas webview installé. En fait, j'ai essayé de désinstaller les paquets système et chrome de mon appareil mais l'application ne se plante toujours pas.

Voici donc ce que j'ai fait (solution bricolée mais qui évite les plantages) :

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
        }
    }

En gros, rien d'autre que de gérer cette exception. Ce n'est pas sorcier.

2voto

Alireza Points 570

Veuillez vous référer à cette question.

Solution de rechange

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);
}

0voto

Trinea Points 86

Mon exception est

android.webkit.WebViewFactory$MissingWebViewPackageException

Failed to load WebView provider: No WebView installed

La pile de détails est :

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)

la solution est

public class MyWebView extends WebView {

    @Override
    public void setOverScrollMode(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;
            }
        }
    }
}

0voto

hzy Points 8

D'après les données du TextView SourceCode

if (mAutoLinkMask != 0) { ... if (Linkify.addLinks(s2, mAutoLinkMask)) { ... } }

La vue de texte avec android:autoLink appellera Linkify.addLinks (atteint la méthode de WebView enfin) et provoquer le crash.

Ainsi, nous pouvons supprimer le android:autoLink et réaliser d'autres moyens de résoudre le problème.

Prograide.com

Prograide est une communauté de développeurs qui cherche à élargir la connaissance de la programmation au-delà de l'anglais.
Pour cela nous avons les plus grands doutes résolus en français et vous pouvez aussi poser vos propres questions ou résoudre celles des autres.

Powered by:

X