• Binary XML file line #2: Error inflating


    1. 06-27 14:29:27.600: E/AndroidRuntime(6936): FATAL EXCEPTION: main  
    2. 06-27 14:29:27.600: E/AndroidRuntime(6936): android.view.InflateException: Binary XML file line #2: Error inflating class   
    3.   
    4. com.example.FileListItem  
    5. 06-27 14:29:27.600: E/AndroidRuntime(6936):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:691)  
    6. 06-27 14:29:27.600: E/AndroidRuntime(6936):     at android.view.LayoutInflater.inflate(LayoutInflater.java:466)  
    7. 06-27 14:29:27.600: E/AndroidRuntime(6936):     at android.view.LayoutInflater.inflate(LayoutInflater.java:396)  
    8. 06-27 14:29:27.600: E/AndroidRuntime(6936):     at com.example.filemanage.FileListAdapter.getView(FileListAdapter.java:51)  
    9. 06-27 14:29:27.600: E/AndroidRuntime(6936):     at android.widget.AbsListView.obtainView(AbsListView.java:2033)  
    10. 06-27 14:29:27.600: E/AndroidRuntime(6936):     at android.widget.ListView.measureHeightOfChildren(ListView.java:1244)  
    11. 06-27 14:29:27.600: E/AndroidRuntime(6936):     at android.widget.ListView.onMeasure(ListView.java:1155)  
    12. 06-27 14:29:27.600: E/AndroidRuntime(6936):     at android.view.View.measure(View.java:12723)  
    13. 06-27 14:29:27.600: E/AndroidRuntime(6936):     at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4698)  
    14. 06-27 14:29:27.600: E/AndroidRuntime(6936):     at android.widget.FrameLayout.onMeasure(FrameLayout.java:293)  
    15. 06-27 14:29:27.600: E/AndroidRuntime(6936):     at android.view.View.measure(View.java:12723)  
    16. 06-27 14:29:27.600: E/AndroidRuntime(6936):     at android.widget.LinearLayout.measureVertical(LinearLayout.java:812)  
    17. 06-27 14:29:27.600: E/AndroidRuntime(6936):     at android.widget.LinearLayout.onMeasure(LinearLayout.java:553)  
    18. 06-27 14:29:27.600: E/AndroidRuntime(6936):     at android.view.View.measure(View.java:12723)  
    19. 06-27 14:29:27.600: E/AndroidRuntime(6936):     at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4698)  
    20. 06-27 14:29:27.600: E/AndroidRuntime(6936):     at android.widget.FrameLayout.onMeasure(FrameLayout.java:293)  
    21. 06-27 14:29:27.600: E/AndroidRuntime(6936):     at android.view.View.measure(View.java:12723)  
    22. 06-27 14:29:27.600: E/AndroidRuntime(6936):     at android.widget.LinearLayout.measureVertical(LinearLayout.java:812)  
    23. 06-27 14:29:27.600: E/AndroidRuntime(6936):     at android.widget.LinearLayout.onMeasure(LinearLayout.java:553)  
    24. 06-27 14:29:27.600: E/AndroidRuntime(6936):     at android.view.View.measure(View.java:12723)  
    25. 06-27 14:29:27.600: E/AndroidRuntime(6936):     at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4698)  
    26. 06-27 14:29:27.600: E/AndroidRuntime(6936):     at android.widget.FrameLayout.onMeasure(FrameLayout.java:293)  
    27. 06-27 14:29:27.600: E/AndroidRuntime(6936):     at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2095)  
    28. 06-27 14:29:27.600: E/AndroidRuntime(6936):     at android.view.View.measure(View.java:12723)  
    29. 06-27 14:29:27.600: E/AndroidRuntime(6936):     at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1064)  
    30. 06-27 14:29:27.600: E/AndroidRuntime(6936):     at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2442)  
    31. 06-27 14:29:27.600: E/AndroidRuntime(6936):     at android.os.Handler.dispatchMessage(Handler.java:99)  
    32. 06-27 14:29:27.600: E/AndroidRuntime(6936):     at android.os.Looper.loop(Looper.java:137)  
    33. 06-27 14:29:27.600: E/AndroidRuntime(6936):     at android.app.ActivityThread.main(ActivityThread.java:4456)  
    34. 06-27 14:29:27.600: E/AndroidRuntime(6936):     at java.lang.reflect.Method.invokeNative(Native Method)  
    35. 06-27 14:29:27.600: E/AndroidRuntime(6936):     at java.lang.reflect.Method.invoke(Method.java:511)  
    36. 06-27 14:29:27.600: E/AndroidRuntime(6936):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:787)  
    37. 06-27 14:29:27.600: E/AndroidRuntime(6936):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:554)  
    38. 06-27 14:29:27.600: E/AndroidRuntime(6936):     at dalvik.system.NativeStart.main(Native Method)  
    39. 06-27 14:29:27.600: E/AndroidRuntime(6936): Caused by: java.lang.ClassNotFoundException: com.example.FileListItem  
    40. 06-27 14:29:27.600: E/AndroidRuntime(6936):     at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)  
    41. 06-27 14:29:27.600: E/AndroidRuntime(6936):     at java.lang.ClassLoader.loadClass(ClassLoader.java:501)  
    42. 06-27 14:29:27.600: E/AndroidRuntime(6936):     at java.lang.ClassLoader.loadClass(ClassLoader.java:461)  
    43. 06-27 14:29:27.600: E/AndroidRuntime(6936):     at android.view.LayoutInflater.createView(LayoutInflater.java:552)  
    44. 06-27 14:29:27.600: E/AndroidRuntime(6936):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:680)  
    45. 06-27 14:29:27.600: E/AndroidRuntime(6936):     ... 33 more  

    如果报这个错误有可能是布局文件中有自定义View    记得修改自定义布局包名

    像我这边就包名写错了,一直报错,com.example.filemanage包下找不到FileListItem这个类

    <com.example.filemanage.FileListItem    xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:paddingTop="5dip"
        android:paddingBottom="5dip"
        android:orientation="horizontal"
        android:gravity="center_vertical">

  • 相关阅读:
    C语言的数组,指针,二级指针,指针数组和数组指针的简单理解
    bash shell 中时间操作常用方法总结
    常见字符串操作方式总结
    查看机器负载常用姿势总结
    netstat命令常用总结
    【技术累积】【点】【java】【20】static关键字
    【技术累积】【点】【java】【19】访问权限
    【技术累积】【点】【java】【18】URLEncode
    【技术累积】【点】【sql】【17】了解索引
    【技术累积】【点】【算法】【17】算法的时间复杂度和空间复杂度
  • 原文地址:https://www.cnblogs.com/zhangyubao/p/7011043.html
Copyright © 2020-2023  润新知