加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

InflateException:Binary XML file line #105: Error inflating

发布时间:2020-12-16 06:23:12 所属栏目:百科 来源:网络整理
导读:项目在某些手机上偶尔会发生以下异常log: com.sogou.map.android.mapsncom.sogou.map.android.mapsnuncaught exception at Fri Apr 10 03:46:19 GMT+08:00 2015nandroid.view.InflateException: Binary XML file line #105: Error inflating class unkno

项目在某些手机上偶尔会发生以下异常log:

com.sogou.map.android.mapsncom.sogou.map.android.mapsnuncaught exception at Fri Apr 10 03:46:19 GMT+08:00 2015nandroid.view.InflateException: Binary XML file line #105: Error inflating class <unknown>

android.view.LayoutInflater.createView(LayoutInflater.java:623)

com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)

android.view.LayoutInflater.onCreateView(LayoutInflater.java:672)

android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:697)ntat android.view.LayoutInflater.rInflate(LayoutInflater.java:758)

android.view.LayoutInflater.rInflate(LayoutInflater.java:761)ntat android.view.LayoutInflater.inflate(LayoutInflater.java:495)

android.view.LayoutInflater.inflate(LayoutInflater.java:400)ntat android.view.LayoutInflater.inflate(LayoutInflater.java:353)

android.view.View.inflate(View.java:17483)ntat


java代码中是通过View.inflate加载布局文件

布局文件xml文件对应105行是个系统的FrameLayout

<FrameLayout
android:layout_width="165dp"
android:layout_height="165dp"
android:background="@drawable/pic" >
</FrameLayout>


上网找资料找了好久,可能的情况是pic的图片太大,inflate时候造成VM内存溢出,inflate过程抛出InflateException

所以减小pic的大小

或者可以通过

try { view = View.inflate(context,R.layout.main,null); } catch (InflateException e) { System.gc(); view =View.inflate(context,null); }

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读