无暇之泪
2017-11-13 08:58
采纳率: 100%
浏览 7.8k

Android 8.0使用webview加载html崩溃

低于8.0版本则正常使用,错误log如下

 Process: com.dhcc.csr, PID: 10366
                                                              java.lang.RuntimeException: Unable to start activity ComponentInfo{com.dhcc.csr/com.dhcc.csr.news.detail.PartyDynamicDetailActivity}: android.view.InflateException: Binary XML file line #0: Binary XML file line #0: Error inflating class android.webkit.WebView
                                                                  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2817)
                                                                  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892)
                                                                  at android.app.ActivityThread.-wrap11(Unknown Source:0)
                                                                  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593)
                                                                  at android.os.Handler.dispatchMessage(Handler.java:105)
                                                                  at android.os.Looper.loop(Looper.java:164)
                                                                  at android.app.ActivityThread.main(ActivityThread.java:6541)
                                                                  at java.lang.reflect.Method.invoke(Native Method)
                                                                  at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
                                                                  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
                                                               Caused by: android.view.InflateException: Binary XML file line #0: Binary XML file line #0: Error inflating class android.webkit.WebView
                                                               Caused by: android.view.InflateException: Binary XML file line #0: Error inflating class android.webkit.WebView
                                                               Caused by: java.lang.reflect.InvocationTargetException
                                                                  at java.lang.reflect.Constructor.newInstance0(Native Method)
                                                                  at java.lang.reflect.Constructor.newInstance(Constructor.java:334)
                                                                  at android.view.LayoutInflater.createView(LayoutInflater.java:647)
                                                                  at com.android.internal.policy.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:58)
                                                                  at android.view.LayoutInflater.onCreateView(LayoutInflater.java:720)
                                                                  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:788)
                                                                  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
                                                                  at android.view.LayoutInflater.rInflate(LayoutInflater.java:863)
                                                                  at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
                                                                  at android.view.LayoutInflater.rInflate(LayoutInflater.java:866)
                                                                  at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
                                                                  at android.view.LayoutInflater.rInflate(LayoutInflater.java:866)
                                                                  at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
                                                                  at android.view.LayoutInflater.rInflate(LayoutInflater.java:866)
                                                                  at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
                                                                  at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
                                                                  at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
                                                                  at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
                                                                  at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:418)
                                                                  at android.app.Activity.setContentView(Activity.java:2654)
                                                                  at com.dhcc.csr.news.detail.PartyDynamicDetailActivity.onCreate(PartyDynamicDetailActivity.java:94)
                                                                  at android.app.Activity.performCreate(Activity.java:6975)
                                                                  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1213)
                                                                  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2770)
                                                                  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892)
                                                                  at android.app.ActivityThread.-wrap11(Unknown Source:0)
                                                                  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593)
                                                                  at android.os.Handler.dispatchMessage(Handler.java:105)
                                                                  at android.os.Looper.loop(Looper.java:164)
                                                                  at android.app.ActivityThread.main(ActivityThread.java:6541)
                                                                  at java.lang.reflect.Method.invoke(Native Method)
                                                                  at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
                                                                  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
                                                               Caused by: java.lang.NullPointerException
                                                                  at android.content.res.AssetManager.addAssetPathNative(Native Method)
                                                                  at android.content.res.AssetManager.addAssetPathInternal(AssetManager.java:689)
                                                                  at android.content.res.AssetManager.addAssetPathAsSharedLibrary(AssetManager.java:684)
                                                                  at android.webkit.WebViewFactory.getProviderClass(WebViewFactory.java:407)
                                                                  at android.webkit.WebViewFactory.getProvider(WebViewFactory.java:211)
11-13 16:50:39.410 10366-10366/com.dhcc.csr E/AndroidRuntime:     at android.webkit.WebView.getFactory(WebView.java:2467)
                                                                  at android.webkit.WebView.ensureProviderCreated(WebView.java:2462)
                                                                  at android.webkit.WebView.setOverScrollMode(WebView.java:2527)
                                                                  at android.view.View.<init>(View.java:4536)
                                                                  at android.view.View.<init>(View.java:4668)
                                                                  at android.view.ViewGroup.<init>(ViewGroup.java:597)
                                                                  at android.widget.AbsoluteLayout.<init>(AbsoluteLayout.java:55)
                                                                  at android.webkit.WebView.<init>(WebView.java:636)
                                                                  at android.webkit.WebView.<init>(WebView.java:581)
                                                                  at android.webkit.WebView.<init>(WebView.java:564)
                                                                  at android.webkit.WebView.<init>(WebView.java:551)
                                                                    ... 33 more
  • 写回答
  • 好问题 提建议
  • 关注问题
  • 收藏
  • 邀请回答

5条回答 默认 最新

  • weixin_39881016 2017-11-23 10:14
    已采纳

    不是xml问题,是webview在android8.0的问题,你可以看看这个https://support.google.com/work/android/answer/7506908?hl=en

    已采纳该答案
    评论
    解决 无用
    打赏 举报
  • qq_21206775 2017-11-13 09:03

    看着像你布局xml出错了

    评论
    解决 无用
    打赏 举报
  • qq_41045121 2017-11-13 09:12

    Process: com.dhcc.csr, PID: 10366
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.dhcc.csr/com.dhcc.csr.news.detail.PartyDynamicDetailActivity}: android.view.InflateException: Binary XML file line #0: Binary XML file line #0: Error inflating class android.webkit.WebView
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2817)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892)
    at android.app.ActivityThread.-wrap11(Unknown Source:0)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593)
    at android.os.Handler.dispatchMessage(Handler.java:105)
    at android.os.Looper.loop(Looper.java:164)
    at android.app.ActivityThread.main(ActivityThread.java:6541)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
    Caused by: android.view.InflateException: Binary XML file line #0: Binary XML file line #0: Error inflating class android.webkit.WebView
    Caused by: android.view.InflateException: Binary XML file line #0: Error inflating class android.webkit.WebView
    Caused by: java.lang.reflect.InvocationTargetException
    at java.lang.reflect.Constructor.newInstance0(Native Method)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:334)
    at android.view.LayoutInflater.createView(LayoutInflater.java:647)
    at com.android.internal.policy.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:58)
    at android.view.LayoutInflater.onCreateView(LayoutInflater.java:720)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:788)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:863)
    at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:866)
    at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:866)
    at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:866)
    at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
    at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:418)
    at android.app.Activity.setContentView(Activity.java:2654)
    at com.dhcc.csr.news.detail.PartyDynamicDetailActivity.onCreate(PartyDynamicDetailActivity.java:94)
    at android.app.Activity.performCreate(Activity.java:6975)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1213)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2770)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892)
    at android.app.ActivityThread.-wrap11(Unknown Source:0)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593)
    at android.os.Handler.dispatchMessage(Handler.java:105)
    at android.os.Looper.loop(Looper.java:164)
    at android.app.ActivityThread.main(ActivityThread.java:6541)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
    Caused by: java.lang.NullPointerException
    at android.content.res.AssetManager.addAssetPathNative(Native Method)
    at android.content.res.AssetManager.addAssetPathInternal(AssetManager.java:689)
    at android.content.res.AssetManager.addAssetPathAsSharedLibrary(AssetManager.java:684)
    at android.webkit.WebViewFactory.getProviderClass(WebViewFactory.java:407)
    at android.webkit.WebViewFactory.getProvider(WebViewFactory.java:211)
    11-13 16:50:39.410 10366-10366/com.dhcc.csr E/AndroidRuntime: at android.webkit.WebView.getFactory(WebView.java:2467)
    at android.webkit.WebView.ensureProviderCreated(WebView.java:2462)
    at android.webkit.WebView.setOverScrollMode(WebView.java:2527)
    at android.view.View.(View.java:4536)
    at android.view.View.(View.java:4668)
    at android.view.ViewGroup.(ViewGroup.java:597)
    at android.widget.AbsoluteLayout.(AbsoluteLayout.java:55)
    at android.webkit.WebView.(WebView.java:636)
    at android.webkit.WebView.(WebView.java:581)
    at android.webkit.WebView.(WebView.java:564)
    at android.webkit.WebView.(WebView.java:551)
    ... 33 more

    评论
    解决 无用
    打赏 举报
  • 行走在三途河川 2017-11-13 09:53

    你布局的单词拼写错了吧 检查下你web页面的布局中 有拼写错误~!

    评论
    解决 无用
    打赏 举报
  • sinatZeay 2017-12-25 07:07
    评论
    解决 无用
    打赏 举报

相关推荐 更多相似问题