android.view.InflateException: Binary XML file line #46异常处理

先来看下报的异常,仅仅贴了主要部分:

Process: com.dudu.duduhelper, PID: 13694
                  android.view.InflateException: Binary XML file line #46: Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference
                      at android.view.LayoutInflater.inflate(LayoutInflater.java:543)
                      at android.view.LayoutInflater.inflate(LayoutInflater.java:427)
                      at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
                      at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:393)
                      at com.dudu.duduhelper.Activity.BigBandActivity.ShopProductAddActivity.showAlertDailog(ShopProductAddActivity.java:151)
                      at com.dudu.duduhelper.Activity.BigBandActivity.ShopProductAddActivity.SubmitProduct(ShopProductAddActivity.java:347)
                      at com.dudu.duduhelper.Activity.BigBandActivity.ShopProductAddActivity.access$1000(ShopProductAddActivity.java:67)
                      at com.dudu.duduhelper.Activity.BigBandActivity.ShopProductAddActivity$11.onClick(ShopProductAddActivity.java:510)

这个异常是加载xml文件异常, 也定位到具体的位置:

android.view.InflateException: Binary XML file line #46:

还有代码中首次出现的位置:

at com.dudu.duduhelper.Activity.BigBandActivity.ShopProductAddActivity.showAlertDailog(ShopProductAddActivity.java:151)

解析过来就是说在你的源码的151行位置加载xml文件报错了,对应的xml中的46行有错误。

对应的xml文件:

<span style="font-family:Arial, Helvetica, sans-serif;"></span><pre name="code" class="html">    android:src="@color/list_divide"/>
        <LinearLayout
            android:layout_width="match_parent"
            android:orientation="horizontal"
            android:layout_height="50dp">
            <Button
                android:id="@+id/confirm"
                android:layout_width="0dp"
                android:layout_weight="1"
                android:layout_height="match_parent"
                android:background="@null"
                android:text="确定"
                android:textSize="18dp"
                />
            <view
                android:layout_width="0.5dp"
                android:layout_height="match_parent"
                android:src="@color/list_divide"/

细心的朋友已经发现错误了,46行是<view 这里,我的v是小写,但是编辑的时候不报错,只有程序编译才报错,所以不容易发现。

以后类似的问题就可以分2步去解析:先看错误日志定位源码位置,根据源码位置找错误的xml位置。



                
  • 18
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 10
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 10
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值