1

Can anyone tell me whats wrong with this layout? Because I can't seem to find anything unusual that could cause InflateException. Also I am getting this exception mostly on Samsung Devices, others seem to work more or less fine. Full exception

Fatal Exception: java.lang.RuntimeException Unable to start activity ComponentInfo{class name}: android.view.InflateException: Binary XML file line #0: Error inflating {class name}

 <?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout   
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/loginContainer"
    style="@style/AuthenticationTheme"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:alpha="0">

    <LinearLayout
        android:id="@+id/holder"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent">

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="12dp"
            android:gravity="center"
            android:text="@string/window_enter_identifier_greeting_label"
            android:textAlignment="center"
            android:textSize="26sp" />

        <TextView
            android:id="@+id/info"
            style="@style/AuthenticationTheme"
            android:layout_width="match_parent"
            android:layout_height="50dp"
            android:layout_marginLeft="@dimen/authentication_margin_from_sides"
            android:layout_marginRight="@dimen/authentication_margin_from_sides"
            android:gravity="center"
            android:text="@string/window_enter_identifier_phone_description_label"
            android:textAlignment="center"
            android:textSize="16sp" />

        <LinearLayout
            android:id="@+id/phoneInputHolder"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical">

            <com.custom.authentication.views.IdentifierInputView
                android:id="@+id/authenticationInput"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginLeft="@dimen/authentication_margin_from_sides"
                android:layout_marginRight="@dimen/authentication_margin_from_sides" />

        </LinearLayout>
    </LinearLayout>

    <com.custom.authentication.views.BottomButtonsView
        android:id="@+id/bottomButtons"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:linkText="@string/window_enter_identifier_login_with_email_button"
        app:mainText="@string/Continue" />

</android.support.constraint.ConstraintLayout>

I am inflating this layout in my custom view class like this:

class EnterIdentifierView(context: Context) : ConstraintLayout(context) {

    init {
        inflate(context, R.layout.view_enter_identifier, this)

    }    

And creating my custom view like this:

override fun onCreateControllerView(layoutInflater: LayoutInflater, viewParent: ViewGroup) = EnterIdentifierView(layoutInflater.context)
Ugnius V
  • 25
  • 6

1 Answers1

0

I don't think this is an answer, more of a suggestion, but as I don't have enough reputation have to post it as such.

From my experience when I get this type of error it sometimes indicates an OutOfMemory error, check to make sure your custom classes aren't trying to load any large images etc.

Also check the full Stacktrace carefully, if you have access to one, for any OOMs

Keith Mthunzi
  • 141
  • 1
  • 7