0

I've made this very simple app with just a RecyclerView and a dialog that pops up prompting you to enter info you want to save in a SQLite database. It's not really a serious project, but the app for some reason crashes on Lollipop and gives InlfateException: Binary XML file line #N: Error inflating class EditText when pressing the button that opens the dialog for the user to insert information. I've checked absolutely everywhere for this and I haven't found solution for it. I have had apps not work properly on Lollipop before and I wasn't able to fix it. I have found some other StackOverflow posts about it and they say that it's a gradle problem, but they were really outdated so they were no use to me. App works fine on anything above Lollipop. Tested on both a physical and a virtual device

Edit:

Dialog xml code:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#000"
    android:padding="16dp">

    <EditText
        android:id="@+id/editWord"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/custom_et"
        android:fontFamily="@font/sf_light"
        android:hint="Word"
        android:inputType="text"
        android:padding="10dp"
        android:textColorHint="#474747" />

    <EditText
        android:id="@+id/editWordDesc"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/editWord"
        android:layout_marginTop="20dp"
        android:background="@drawable/custom_et"
        android:fontFamily="@font/sf_light"
        android:hint="Word Meaning"
        android:inputType="text"
        android:padding="10dp"
        android:textColorHint="#474747" />
</RelativeLayout>

Main activity XML code:

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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"
    tools:context=".MainActivity"
    android:background="#000"
    android:padding="10dp">

    <com.google.android.material.floatingactionbutton.FloatingActionButton
        android:id="@+id/fab"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:backgroundTint="#232323"
        android:layout_marginEnd="8dp"
        android:layout_marginBottom="8dp"
        app:borderWidth="0dp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="1.0"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        android:src="@drawable/ic_add"
        app:layout_constraintVertical_bias="1.0" />

    <androidx.recyclerview.widget.RecyclerView
        android:id="@+id/recyclerView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

Edit 2: InlfateException: Binary XML file line #9: Error inflating class EditText for the dialog layout

Edit 3: the problem was with the custom_et file and removing it fixed the problem.

  • Please share the XML code where you're getting this error. – Ali Ahsan Nov 01 '20 at 15:27
  • Does this answer your question? [android.view.InflateException: Binary XML file line #7: Error inflating class Toolbar](https://stackoverflow.com/questions/26463160/android-view-inflateexception-binary-xml-file-line-7-error-inflating-class-to) – Rob Evans Nov 01 '20 at 15:38
  • InlfateException: Binary XML file line #N: Error inflating class EditText. N should be a number referring to the line number. please share the actual error message. – MehranB Nov 01 '20 at 19:41
  • My best guess for now is this. @drawable/custom_et cannot be inflated because of the format of the file (whatever format it is, maybe it is not compatible with lollipop). To test it, remove the drawable line for both TextViews and try to run it. if it works search for the problem in your @drawable/custom_et file. – MehranB Nov 01 '20 at 19:50
  • We need the COMPLETE exception stack trace to tell you what the error is – EpicPandaForce Nov 02 '20 at 17:05

0 Answers0