问题描述
我在5.1.1版的Samsung SM G920F(Galaxy S6)中找到了有关Crashlytics的崩溃报告(在所有未检索到相同错误的其他设备上).
I found a crash report on Crashlytics in a Samsung SM G920F (Galaxy S6), version 5.1.1 (on all other devices I didn't retrieve same error).
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mypackage/com.mypackage.myactivity}:
android.view.InflateException: Binary XML file line #21: Error inflating class android.webkit.WebView
这是我的网络视图的布局(样式是空样式):
This is the layout of my webview (the style is an empty style):
<?xml version="1.0" encoding="utf-8"?>
<WebView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/my_webview_id"
style="@style/MyEmptyStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/transparent" />
这就是我将其包括在活动布局中的方式:
This is how I include it in activity layout:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<include layout="@layout/my_webview_layout"
android:visibility="gone"/>
</LinearLayout>
报告的错误是XML错误,因此我提供了所有代码(简体).这是一份报告,因此仅在此设备上发生过一次,有人可以向我解释原因吗?
The error reported is an XML error so I provided all code (simplified).This is a single report so it happened only one time on this device, can someone explain me why?
编辑(完整的堆栈跟踪)
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mypackage/com.mypackage.myactivity}: android.view.InflateException: Binary XML file line #21: Error inflating class android.webkit.WebView
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3119)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3218)
at android.app.ActivityThread.access$1000(ActivityThread.java:198)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1676)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:6837)
at java.lang.reflect.Method.invoke(Method.java)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)
Caused by: android.view.InflateException: Binary XML file line #21: Error inflating class android.webkit.WebView
at android.view.LayoutInflater.createView(LayoutInflater.java:640)
at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:55)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:689)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:748)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:813)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:821)
at android.view.LayoutInflater.parseInclude(LayoutInflater.java:933)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:809)
at android.view.LayoutInflater.inflate(LayoutInflater.java:511)
at android.view.LayoutInflater.inflate(LayoutInflater.java:415)
at com.mypackage.drawer.fragments.Myfragment.createContentView(Myfragment.java:50)
at com.externalpackage.app.ExternalFragment.onCreateView(ExternalFragment.java:115)
at com.externalpackage.app.LocationExternalFragment.onCreateView(LocationExternalFragment.java:65)
at com.mypackage.drawer.fragments.Myfragment.onCreateView(Myfragment.java:55)
at android.app.Fragment.performCreateView(Fragment.java:2114)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:904)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1082)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1064)
at android.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManager.java:1884)
at android.app.Activity.performCreateCommon(Activity.java:6492)
at android.app.Activity.performCreate(Activity.java:6521)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1120)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3072)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3218)
at android.app.ActivityThread.access$1000(ActivityThread.java:198)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1676)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:6837)
at java.lang.reflect.Method.invoke(Method.java)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance(Constructor.java)
at java.lang.reflect.Constructor.newInstance(Constructor.java:288)
at android.view.LayoutInflater.createView(LayoutInflater.java:614)
at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:55)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:689)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:748)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:813)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:821)
at android.view.LayoutInflater.parseInclude(LayoutInflater.java:933)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:809)
at android.view.LayoutInflater.inflate(LayoutInflater.java:511)
at android.view.LayoutInflater.inflate(LayoutInflater.java:415)
at com.mypackage.drawer.fragments.Myfragment.createContentView(Myfragment.java:50)
at com.externalpackage.app.ExternalFragment.onCreateView(ExternalFragment.java:115)
at com.externalpackage.app.LocationExternalFragment.onCreateView(LocationExternalFragment.java:65)
at com.mypackage.drawer.fragments.Myfragment.onCreateView(Myfragment.java:55)
at android.app.Fragment.performCreateView(Fragment.java:2114)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:904)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1082)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1064)
at android.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManager.java:1884)
at android.app.Activity.performCreateCommon(Activity.java:6492)
at android.app.Activity.performCreate(Activity.java:6521)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1120)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3072)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3218)
at android.app.ActivityThread.access$1000(ActivityThread.java:198)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1676)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:6837)
at java.lang.reflect.Method.invoke(Method.java)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)
Caused by: android.util.AndroidRuntimeException: android.content.pm.PackageManager$NameNotFoundException: com.google.android.webview
at android.webkit.WebViewFactory.getFactoryClass(WebViewFactory.java:174)
at android.webkit.WebViewFactory.getProvider(WebViewFactory.java:109)
at android.webkit.WebView.getFactory(WebView.java:2202)
at android.webkit.WebView.ensureProviderCreated(WebView.java:2197)
at android.webkit.WebView.setOverScrollMode(WebView.java:2256)
at android.view.View.<init>(View.java:3843)
at android.view.View.<init>(View.java:3954)
at android.view.ViewGroup.<init>(ViewGroup.java:513)
at android.widget.AbsoluteLayout.<init>(AbsoluteLayout.java:55)
at android.webkit.WebView.<init>(WebView.java:553)
at android.webkit.WebView.<init>(WebView.java:498)
at android.webkit.WebView.<init>(WebView.java:481)
at android.webkit.WebView.<init>(WebView.java:468)
at java.lang.reflect.Constructor.newInstance(Constructor.java)
at java.lang.reflect.Constructor.newInstance(Constructor.java:288)
at android.view.LayoutInflater.createView(LayoutInflater.java:614)
at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:55)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:689)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:748)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:813)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:821)
at android.view.LayoutInflater.parseInclude(LayoutInflater.java:933)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:809)
at android.view.LayoutInflater.inflate(LayoutInflater.java:511)
at android.view.LayoutInflater.inflate(LayoutInflater.java:415)
at com.mypackage.drawer.fragments.Myfragment.createContentView(Myfragment.java:50)
at com.externalpackage.app.ExternalFragment.onCreateView(ExternalFragment.java:115)
at com.externalpackage.app.LocationExternalFragment.onCreateView(LocationExternalFragment.java:65)
at com.mypackage.drawer.fragments.Myfragment.onCreateView(Myfragment.java:55)
at android.app.Fragment.performCreateView(Fragment.java:2114)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:904)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1082)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1064)
at android.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManager.java:1884)
at android.app.Activity.performCreateCommon(Activity.java:6492)
at android.app.Activity.performCreate(Activity.java:6521)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1120)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3072)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3218)
at android.app.ActivityThread.access$1000(ActivityThread.java:198)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1676)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:6837)
at java.lang.reflect.Method.invoke(Method.java)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)
Caused by: android.content.pm.PackageManager$NameNotFoundException: com.google.android.webview
at android.app.ApplicationPackageManager.getPackageInfo(ApplicationPackageManager.java:167)
at android.webkit.WebViewFactory.getFactoryClass(WebViewFactory.java:146)
at android.webkit.WebViewFactory.getProvider(WebViewFactory.java:109)
at android.webkit.WebView.getFactory(WebView.java:2202)
at android.webkit.WebView.ensureProviderCreated(WebView.java:2197)
at android.webkit.WebView.setOverScrollMode(WebView.java:2256)
at android.view.View.<init>(View.java:3843)
at android.view.View.<init>(View.java:3954)
at android.view.ViewGroup.<init>(ViewGroup.java:513)
at android.widget.AbsoluteLayout.<init>(AbsoluteLayout.java:55)
at android.webkit.WebView.<init>(WebView.java:553)
at android.webkit.WebView.<init>(WebView.java:498)
at android.webkit.WebView.<init>(WebView.java:481)
at android.webkit.WebView.<init>(WebView.java:468)
at java.lang.reflect.Constructor.newInstance(Constructor.java)
at java.lang.reflect.Constructor.newInstance(Constructor.java:288)
at android.view.LayoutInflater.createView(LayoutInflater.java:614)
at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:55)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:689)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:748)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:813)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:821)
at android.view.LayoutInflater.parseInclude(LayoutInflater.java:933)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:809)
at android.view.LayoutInflater.inflate(LayoutInflater.java:511)
at android.view.LayoutInflater.inflate(LayoutInflater.java:415)
at com.mypackage.drawer.fragments.Myfragment.createContentView(Myfragment.java:50)
at com.externalpackage.app.ExternalFragment.onCreateView(ExternalFragment.java:115)
at com.externalpackage.app.LocationExternalFragment.onCreateView(LocationExternalFragment.java:65)
at com.mypackage.drawer.fragments.Myfragment.onCreateView(Myfragment.java:55)
at android.app.Fragment.performCreateView(Fragment.java:2114)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:904)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1082)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1064)
at android.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManager.java:1884)
at android.app.Activity.performCreateCommon(Activity.java:6492)
at android.app.Activity.performCreate(Activity.java:6521)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1120)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3072)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3218)
at android.app.ActivityThread.access$1000(ActivityThread.java:198)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1676)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:6837)
at java.lang.reflect.Method.invoke(Method.java)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)
推荐答案
当应用膨胀WebView时,似乎发生了一些奇怪的事情.
It seems that something strange ocurred when the app was inflating the WebView, could be whatever.
对于 NameNotFoundException:com.google.android.webview
我可以推断出这可能是Google软件包的问题(用户可能正在使用自定义ROM而未安装它们.)
For the NameNotFoundException: com.google.android.webview
I can deduce that could be a problem with the Google packages (The user could be using a custom ROM and not having them installed.)
如果您有关于该错误的终端的更多信息,我会说您坚持要这样做,但是您必须查看所拥有的users/users_with_this_error所占的比例.然后,您会发现它对您解决此问题是否有用.
If you had more info about the terminal with the error I'll say you go for it, but you have to see the proportion of users/users_with_this_error that you have. Then you could see if it's useful for you work in this issue or not.
摘自断裂线的评论:看看这篇文章,看起来有点像相同的问题: NameNotFoundException网络视图
From breakline's comment:Check out this post, looks kinda like the same issue: NameNotFoundException webview
这篇关于膨胀WebView XML时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!