javaandroidinflate-exception

InflateException on setContentView(R.layout.activity_login);


I tried to open my app on my samsung android 6.0; but it gives me this exception:

11-15 17:29:40.751 11631-11631/? E/Zygote: v2
11-15 17:29:40.751 11631-11631/? E/Zygote: accessInfo : 0
11-15 17:29:41.251 11631-11631/com.example.meetgreet E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.example.meetgreet, PID: 11631
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.meetgreet/app.meetgreet.meetgreet.LoginActivity}: android.view.InflateException: Binary XML file line #61: Binary XML file line #61: Error inflating class <unknown>

But in my activity_login.xml on line 61:

<androidx.constraintlayout.widget.ConstraintLayout
            android:id="@+id/constraintLayout"
            android:layout_width="0dp"
            android:layout_height="62dp"
            android:layout_marginStart="8dp"
            android:layout_marginLeft="8dp"
            android:layout_marginTop="24dp"
            android:layout_marginEnd="8dp"
            android:layout_marginRight="8dp"
            android:background="@drawable/layout_border"
            android:onClick="nextPhoneInput"
            android:padding="10dp"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@+id/textView2">

Also I have in my build.gradle, I have ConstraintLayout implemented:

implementation 'androidx.constraintlayout:constraintlayout:1.1.3'

Solution

  • What this error means that you have an invalid value present in the XML layout

    Meaning:-If you try to give color value to the dimen value it throws an error in layout. This error suggests that at a given line the value is invalid. I think it is at this line

      app:layout_constraintEnd_toEndOf="parent"
      app:layout_constraintStart_toStartOf="parent"