Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/178.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 我在构建android应用程序时遇到运行时错误_Java_Android_Firebase - Fatal编程技术网

Java 我在构建android应用程序时遇到运行时错误

Java 我在构建android应用程序时遇到运行时错误,java,android,firebase,Java,Android,Firebase,我的错误消息: D/AndroidRuntime: Shutting down VM E/AndroidRuntime: FATAL EXCEPTION: main Process: com.example.blood_doner, PID: 9696 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.blood_doner/com.example.blood_doner.

我的错误消息:

D/AndroidRuntime: Shutting down VM
E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.example.blood_doner, PID: 9696
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.blood_doner/com.example.blood_doner.MainActivity}: android.view.InflateException: Binary XML file line #11 in com.example.blood_doner:layout/activity_main: Binary XML file line #11 in com.example.blood_doner:layout/activity_main: Error inflating class LinearLayoutCompat
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3449)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3601)
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85)
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:223)
        at android.app.ActivityThread.main(ActivityThread.java:7656)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
     Caused by: android.view.InflateException: Binary XML file line #11 in com.example.blood_doner:layout/activity_main: Binary XML file line #11 in com.example.blood_doner:layout/activity_main: Error inflating class LinearLayoutCompat
     Caused by: android.view.InflateException: Binary XML file line #11 in com.example.blood_doner:layout/activity_main: Error inflating class LinearLayoutCompat
     Caused by: java.lang.ClassNotFoundException: android.view.LinearLayoutCompat
        at java.lang.Class.classForName(Native Method)
        at java.lang.Class.forName(Class.java:454)
        at android.view.LayoutInflater.createView(LayoutInflater.java:813)
        at android.view.LayoutInflater.createView(LayoutInflater.java:774)
        at android.view.LayoutInflater.onCreateView(LayoutInflater.java:911)
        at com.android.internal.policy.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:68)
        at android.view.LayoutInflater.onCreateView(LayoutInflater.java:928)
        at android.view.LayoutInflater.onCreateView(LayoutInflater.java:948)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1002)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:959)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:1121)
        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1082)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:680)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:532)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:479)
        at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:696)
        at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:170)
        at com.example.blood_doner.MainActivity.onCreate(MainActivity.java:24)
        at android.app.Activity.performCreate(Activity.java:8000)
        at android.app.Activity.performCreate(Activity.java:7984)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1309)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3422)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3601)
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85)
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:223)
        at android.app.ActivityThread.main(ActivityThread.java:7656)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
     Caused by: java.lang.ClassNotFoundException: Didn't find class "android.view.LinearLayoutCompat" on path: DexPathList[[zip file "/data/app/~~E_zA6DvG2UIaGgWdJTrtLw==/com.example.blood_doner-WiH1_nFAcKgFOSBhTUwffw==/base.apk"],nativeLibraryDirectories=[/data/app/~~E_zA6DvG2UIaGgWdJTrtLw==/com.example.blood_doner-WiH1_nFAcKgFOSBhTUwffw==/lib/x86, /system/lib, /system_ext/lib]]
        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:207)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
            ... 33 more
I/Process: Sending signal. PID: 9696 SIG: 9
My activity_Main.xml

    <?xml version="1.0" encoding="utf-8"?>
    <androidx.drawerlayout.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@drawable/background_image"
        android:id="@+id/drawer_layout"
        tools:context=".MainActivity">
    
        <LinearLayoutCompat
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical"
            >
    
            <include
                layout="@layout/main_toolbar"/>
    
          <TextView
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:text="Home"
              android:textSize="50sp"
              android:textStyle="bold"
              android:gravity="center"/>
    
    
    
        </LinearLayoutCompat>
    
        <RelativeLayout
            android:layout_width="300dp"
            android:layout_height="match_parent"
            android:gravity="start"
            android:background="@drawable/background_image">
    
        </RelativeLayout>
        <include
            layout="@layout/main_nav_drawer"/>
    
    
    
        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
    >
    
            <RelativeLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginRight="16dp"
                android:layout_marginLeft="16dp"
                android:id="@+id/top_layout"
                >
    
                <ImageView
                    android:id="@+id/helpline_button"
                    android:layout_width="180dp"
                    android:layout_height="150dp"
                    android:layout_marginTop="10dp"
                    android:layout_marginRight="20dp"
                    android:background="@drawable/rounded_image"
                    android:padding="5dp"
                    android:layout_below="@+id/request_button"
                    app:srcCompat="@drawable/helpline"
                    tools:ignore="MissingConstraints"
    
                    />
    
                <ImageView
                    android:id="@+id/request_button"
                    android:layout_width="180dp"
                    android:layout_height="150dp"
                    android:layout_marginRight="20dp"
                    android:layout_marginTop="50dp"
                    android:background="@drawable/rounded_image"
                    android:padding="5dp"
                    app:srcCompat="@drawable/request"
                    android:layout_alignParentLeft="true"
                    />
    
                <ImageView
                    android:id="@+id/organization_button"
                    android:layout_width="180dp"
                    android:layout_height="150dp"
                    android:layout_alignParentRight="true"
                    android:layout_marginTop="50dp"
    
                    android:background="@drawable/rounded_image"
    
                    android:padding="5dp"
                    app:srcCompat="@drawable/organization" />
    
                <ImageView
                    android:id="@+id/plasma_button"
                    android:layout_width="180dp"
                    android:layout_height="150dp"
    
                    android:background="@drawable/rounded_image"
                    android:padding="5dp"
                    android:layout_marginTop="10dp"
                    app:srcCompat="@drawable/plasma"
                    android:layout_below="@+id/organization_button"
                    android:layout_alignParentRight="true"/>
    
    
            </RelativeLayout>
    
            <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginRight="16dp"
                android:layout_marginLeft="16dp"
                android:layout_marginTop="30dp"
                android:layout_below="@+id/top_layout"
                android:id="@+id/blood_group"
    
                >
    
                <ImageView
                    android:id="@+id/a_positive_button"
                    android:layout_width="70dp"
                    android:layout_height="70dp"
                    android:layout_marginRight="30dp"
                    android:background="@drawable/rounded_image"
                    app:srcCompat="@drawable/a_positive" />
    
                <ImageView
                    android:id="@+id/a_negative_button"
                    android:layout_width="70dp"
                    android:layout_height="70dp"
                    android:layout_marginRight="30dp"
                    android:background="@drawable/rounded_image"
                    android:layout_toRightOf="@+id/a_positive_button"
                    app:srcCompat="@drawable/a_negative"
                    tools:layout_editor_absoluteY="420dp" />
    
                <ImageView
                    android:id="@+id/b_positive_button"
                    android:layout_width="70dp"
                    android:layout_height="70dp"
    
                    android:layout_marginRight="30dp"
                    android:background="@drawable/rounded_image"
                    android:layout_toRightOf="@+id/a_negative_button"
                    app:srcCompat="@drawable/b_positive" />
    
                <ImageView
                    android:id="@+id/b_negative_button"
                    android:layout_width="70dp"
                    android:layout_height="70dp"
                    android:background="@drawable/rounded_image"
                    android:layout_toRightOf="@+id/b_positive_button"
                    app:srcCompat="@drawable/b_negative"
                    />
    
                <ImageView
                    android:id="@+id/ab_positive_button"
                    android:layout_width="70dp"
                    android:layout_height="70dp"
                    android:layout_marginTop="10dp"
                    android:layout_marginRight="30dp"
                    android:background="@drawable/rounded_image"
                    android:layout_below="@+id/a_positive_button"
                    app:srcCompat="@drawable/ab_positive" />
    
                <ImageView
                    android:id="@+id/ab_negative_button"
                    android:layout_width="70dp"
                    android:layout_height="70dp"
                    android:layout_marginTop="10dp"
                    android:layout_marginRight="30dp"
                    android:background="@drawable/rounded_image"
                    android:layout_below="@+id/a_negative_button"
                    android:layout_toRightOf="@+id/ab_positive_button"
                    app:srcCompat="@drawable/ab_negative" />
    
                <ImageView
                    android:id="@+id/o_positive_button"
                    android:layout_width="70dp"
                    android:layout_height="70dp"
                    android:layout_marginTop="10dp"
                    android:layout_marginRight="30dp"
                    android:background="@drawable/rounded_image"
                    android:layout_below="@+id/a_negative_button"
                    android:layout_toRightOf="@+id/ab_negative_button"
                    app:srcCompat="@drawable/o_positive" />
    
    
                <ImageView
                    android:id="@+id/o_negative_button"
                    android:layout_width="70dp"
                    android:layout_height="70dp"
                    android:layout_marginTop="10dp"
                    android:background="@drawable/rounded_image"
                    android:layout_toRightOf="@+id/o_positive_button"
                    android:layout_below="@+id/b_negative_button"
                    app:srcCompat="@drawable/o_negative" />
    
    
            </RelativeLayout>
    
    
            <Button
                android:id="@+id/log_out"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginBottom="16dp"
                android:onClick="logout"
                android:text="Log out"
                android:layout_below="@+id/blood_group"
                android:layout_centerVertical="true"
                android:layout_centerHorizontal="true"
                android:layout_marginTop="30dp"
                />
    
    
        </RelativeLayout>

</androidx.drawerlayout.widget.DrawerLayout>
我不明白问题是什么?我是android开发新手,我不理解任何错误信息。请帮我解决这个问题!当我尝试运行时,应用程序正在崩溃!我已经在顶部给出了我的代码示例和错误消息

更换

<LinearLayoutCompat
            android:layout_width="match_parent"
            android:layout_height="match_parent"

这是LinearLayoutCompat的通货膨胀例外。找不到类。试试线性布局吧!显示您的build.gradle,其中添加了dependenciesThanks…您的建议对我有用。。。。。
<LinearLayoutCompat
            android:layout_width="match_parent"
            android:layout_height="match_parent"
<androidx.appcompat.widget.LinearLayoutCompat
            android:layout_width="match_parent"
            android:layout_height="match_parent"