gys19921114
gys19921114
2016-06-12 07:16
采纳率: 66.7%
浏览 4.2k
已采纳

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

华为P8上运行无碍(5.0以上系统),别的手机上报错

错误代码:
/AndroidRuntime: FATAL EXCEPTION: main
Process: com.caicai.net.myapplication, PID: 21121
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.caicai.net.myapplication/com.caicai.net.myapplication.PlayingMethodActivity}: android.view.InflateException: Binary XML file line #2: Error inflating class
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2201)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2250)
at android.app.ActivityThread.access$900(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1213)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5072)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class
at android.view.LayoutInflater.createView(LayoutInflater.java:623)
at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:672)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:697)
at android.view.LayoutInflater.inflate(LayoutInflater.java:472)
at android.view.LayoutInflater.inflate(LayoutInflater.java:400)
at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:290)
at android.app.Activity.setContentView(Activity.java:1947)
at com.caicai.net.myapplication.PlayingMethodActivity.onCreate(PlayingMethodActivity.java:99)
at android.app.Activity.performCreate(Activity.java:5249)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2165)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2250) 
at android.app.ActivityThread.access$900(ActivityThread.java:141) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1213) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:136) 
at android.app.ActivityThread.main(ActivityThread.java:5072) 
at java.lang.reflect.Method.invokeNative(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:515) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609) 
at dalvik.system.NativeStart.main(Native Method) 

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

5条回答 默认 最新

  • u011325156
    aloneGirle 2016-06-12 09:46
    已采纳

    cause by中指出你的布局文件里面有一个视图类应用不对啊,你还是好好检查下是不是你其他的错误引起的那个类找不见了

    点赞 评论
  • caozhy
    点赞 评论
  • CSDNXIAOS
    Robot-S 2016-06-12 07:31

    最近在做安卓程序的引导页问题,每次当加载引导页的时候总是报错,说未知的填充错误,很是郁闷啊。
    从stackoverflow找到的解决方案:
       当运行的时候,安卓会改变图片的大小(基于屏幕的尺寸和分辨率),安卓使用bitmap去重新改变图片的尺寸。所以,这个是内存非常敏感的行为。一个快速的解决方法是,将比较大的图片复制到drawable-ldpi, mdpi, hdpi 文件夹中。安卓会自动......
    答案就在这里:android.view.InflateException: Binary XML file line#2: Error inflating class
    ----------------------Hi,地球人,我是问答机器人小S,上面的内容就是我狂拽酷炫叼炸天的答案,除了赞同,你还有别的选择吗?

    点赞 评论
  • qq_28026283
    大白大白大白 2016-06-15 02:24

    错误指向布局文件,建议贴出布局文件

    点赞 评论
  • dongfeng9ge
    东风玖哥 2016-10-18 07:07

    你可以把布局文件贴出来让我们看看吗?

    点赞 评论

相关推荐