user9130287
user9130287

Reputation:

Error inflating class TextView in fabric

I am getting crashes on some phones in fabric, I am not able to find and debug it please help.

Here is the log from fabric:-

Fatal Exception: java.lang.RuntimeException: Unable to start activity

ComponentInfo{com.solutions/com.solutions.MainActivity}: android.view.InflateException: Binary XML file line #8: Binary XML file line #8: Error inflating class TextView

Caused by android.view.InflateException: Binary XML file line #8: Error inflating class TextView

**Caused by java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.CharSequence

I have only one textview in mainactivity :

@BindView(R.id.toolbar_title)
TextView toolbar_title;

And I am binding it with butterknife on oncreate with :

ButterKnife.bind(this);

And this textview is inside toolbar so i am setting text inside bottomNavigationView.setOnNavigationItemSelectedListener

And here is xml :-

   <android.support.design.widget.AppBarLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
                android:background="@android:color/transparent"
                android:stateListAnimator="@null"
                android:id="@+id/myappbar"
                >
    
    
               <android.support.v7.widget.Toolbar
                android:id="@+id/toolbar"
                android:layout_width="match_parent"
                android:minHeight="?attr/actionBarSize"
                app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
                app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
                android:layout_height="wrap_content"
                app:layout_scrollFlags="scroll|enterAlways|snap"
                   android:background="@color/grey_700"
    
    
                >
    
    
                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:fontFamily="@font/josefinsans_semibold"
                    android:layout_gravity="center"
                    android:textSize="22sp"
                    android:textColor="@color/white"
                    android:id="@+id/toolbar_title" />
               </android.support.v7.widget.Toolbar>
      </android.support.design.widget.AppBarLayout>

Upvotes: 0

Views: 429

Answers (1)

Phil
Phil

Reputation: 221

From your exception log, the reason is there is a error when parse color list from your xml. try to remove @font/josefinsans_semibold and check the value of @color/white .

<android.support.design.widget.AppBarLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"

 android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
            android:background="@android:color/transparent"
            android:stateListAnimator="@null"
            android:id="@+id/myappbar"
            >


           <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:minHeight="?attr/actionBarSize"
            app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
            app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
            android:layout_height="wrap_content"
            app:layout_scrollFlags="scroll|enterAlways|snap"
               android:background="@color/grey_700"


            >


            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:textSize="22sp"
                android:textColor="#ffffff"
                android:id="@+id/toolbar_title" />
           </android.support.v7.widget.Toolbar>
  </android.support.design.widget.AppBarLayout>

Upvotes: 0

Related Questions