title: android.view.InflateException: Binary XML file line #13: Error inflating class <unknown>
body: <p>I am facing the above error on an app that used to work fine as of few months ago, with no changes since then. The only change is updated Android studio/gradle</p>
  
  <p>The stacktrace   </p>
  
  <pre><code>06-18 21:37:52.817  27995-27995/com.XYZ.carnival.debug E/AndroidRuntime﹕ FATAL EXCEPTION: main
      Process: com.XYZ.carnival.debug, PID: 27995
      java.lang.RuntimeException: Unable to start activity ComponentInfo{com.XYZ.carnival.debug/com.XYZ.carnival.MainActivity}: android.view.InflateException: Binary XML file line #13: Error inflating class &lt;unknown&gt;
              at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2693)
              at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2758)
              at android.app.ActivityThread.access$900(ActivityThread.java:177)
              at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1448)
              at android.os.Handler.dispatchMessage(Handler.java:102)
              at android.os.Looper.loop(Looper.java:145)
              at android.app.ActivityThread.main(ActivityThread.java:5942)
              at java.lang.reflect.Method.invoke(Native Method)
              at java.lang.reflect.Method.invoke(Method.java:372)
              at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1400)
              at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1195)
       Caused by: android.view.InflateException: Binary XML file line #13: Error inflating class &lt;unknown&gt;
              at android.view.LayoutInflater.createView(LayoutInflater.java:640)
              at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:750)
              at android.view.LayoutInflater.rInflate(LayoutInflater.java:813)
              at android.view.LayoutInflater.inflate(LayoutInflater.java:511)
              at android.view.LayoutInflater.inflate(LayoutInflater.java:415)
              at com.XYZ.carnival.drawer.Account.AccountViewController.initAdapter(AccountViewController.java:69)
              at com.XYZ.carnival.drawer.Account.AccountViewController.initViews(AccountViewController.java:53)
              at com.XYZ.carnival.drawer.Account.AccountViewController.&lt;init&gt;(AccountViewController.java:43)
      ....
  </code></pre>
  
  <p>The XML in question is </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:background="#93928c"
      android:orientation="vertical"
      android:paddingBottom="5dp"
      android:paddingLeft="22dp"
      android:paddingRight="20dp"
      android:paddingTop="5sp"&gt;
  
      &lt;com.XYZ.carnival.widgets.CrTextView
          android:id="@+id/tv_account_name"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:gravity="bottom"
          android:minHeight="38dp"
          android:text="MichaelCARN_2839ef1524 Jon Siegal"
          android:textColor="@color/white"
          android:textSize="22sp"
          android:textStyle="bold"
          app:font="@string/lusitana" /&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>And CrTextView</p>
  
  <pre><code>package com.XYZ.carnival.widgets;
  
  import android.content.Context;
  import android.util.AttributeSet;
  import android.widget.TextView;
  
  import com.XYZ.carnival.utils.TypefaceManager;
  
  public class CrTextView extends TextView {
  
      public static final String TAG = CrTextView.class.getSimpleName();
  
      public CrTextView(Context ctx) {
          this(ctx, null);
      }
  
      public CrTextView(Context ctx, AttributeSet attrs) {
          this(ctx, attrs, android.R.attr.textViewStyle);
      }
  
      public CrTextView(Context ctx, AttributeSet attrs, int defStyle) {
          super(ctx, attrs, defStyle);
          init(ctx, attrs, defStyle);
      }
  
      private void init(Context ctx, AttributeSet attrs, int defStyle) {
          if (isInEditMode()) return;
          TypefaceManager.applyFont(this, attrs, defStyle);
      }
  
  }
  </code></pre>
  
  <p>The difference between this and the myriad other questions on this error appears to be that the line refers to a custom widget. If i were to remove this widget, the crash doesnt occur here anymore, but occurs at the next usage of this widget.. and (I suspect) so on..</p>
  
  <p>Any idea into this? We have tried to clean and rebuild project as well..</p>