Android studio编译报错:Error inflating class null

  1. 报错详细信息
  2. 原因:布局文件中的 View 控件忘了大写

报错详细信息

E/AndroidRuntime: FATAL EXCEPTION: main
    Process: top.baixiaoshengzjj.mygraduationapplication, PID: 32630
    java.lang.RuntimeException: Unable to start activity ComponentInfo{top.baixiaoshengzjj.mygraduationapplication/top.baixiaoshengzjj.mygraduationapplication.LoginActivity}: android.view.InflateException: Binary XML file line #141 in top.baixiaoshengzjj.mygraduationapplication:layout/login_page: Binary XML file line #141 in top.baixiaoshengzjj.mygraduationapplication:layout/login_page: Error inflating class null
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3773)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3952)
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:91)
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:149)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:103)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2386)
        at android.os.Handler.dispatchMessage(Handler.java:107)
        at android.os.Looper.loop(Looper.java:213)
        at android.app.ActivityThread.main(ActivityThread.java:8169)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1101)
     Caused by: android.view.InflateException: Binary XML file line #141 in top.baixiaoshengzjj.mygraduationapplication:layout/login_page: Binary XML file line #141 in top.baixiaoshengzjj.mygraduationapplication:layout/login_page: Error inflating class null
     Caused by: android.view.InflateException: Binary XML file line #141 in top.baixiaoshengzjj.mygraduationapplication:layout/login_page: Error inflating class null
     Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference
        at android.view.LayoutInflater.tryCreateView(LayoutInflater.java:1064)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1007)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:971)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:1133)
        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1094)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:1136)
        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1094)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:692)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:536)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:483)
        at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:696)
        at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:170)
        at top.baixiaoshengzjj.mygraduationapplication.LoginActivity.onCreate(LoginActivity.java:14)
        at android.app.Activity.performCreate(Activity.java:8086)
        at android.app.Activity.performCreate(Activity.java:8074)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1313)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3746)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3952)
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:91)
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:149)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:103)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2386)
        at android.os.Handler.dispatchMessage(Handler.java:107)
        at android.os.Looper.loop(Looper.java:213)
        at android.app.ActivityThread.main(ActivityThread.java:8169)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1101)

原因:布局文件中的 View 控件忘了大写


转载请注明来源,欢迎对文章中的引用来源进行考证,欢迎指出任何有错误或不够清晰的表达。可以在下面评论区评论,也可以邮件至 1401362462@qq.com

文章标题:Android studio编译报错:Error inflating class null

字数:493

本文作者:百xiao生

发布时间:2020-12-09, 14:44:14

最后更新:2020-12-09, 14:51:49

原始链接:https://baixiaoshengzjj.top/2020/12/09/Androidstudio%E7%BC%96%E8%AF%91%E6%8A%A5%E9%94%99%20Error%20inflating%20class%20null/

版权声明: "署名-非商用-相同方式共享 4.0" 转载请保留原文链接及作者。