1

I am getting the error as android.view.InflateException: Binary XML file line #89: Error inflating class . Earlier this activity was running fine. But suddenly getting this error. Cleaned the project so many times. But didn't work.

My XML File is :

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/rootCoordinatorLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">

<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#dddddd">

    <include
        layout="@layout/top_menu_layout"
        android:layout_width="match_parent"
        android:layout_height="90dp"
        android:layout_alignParentTop="true" />

    <include layout="@layout/inc_fund_transfer_btn_group" />

    <android.support.v4.widget.NestedScrollView
        android:id="@+id/sectionPaymentInput"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_below="@+id/ftBtnGroup"
        android:scrollbars="vertical">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:padding="3dp">

            <include layout="@layout/inc_ft_fav_transaction" />

            <include layout="@layout/inc_ft_from_acc_info" />


            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_margin="5dp"
                android:background="@drawable/login_btn_bg"
                android:orientation="vertical">

                <android.support.v7.widget.AppCompatTextView
                    style="@style/FTTextViewStyleTitle"
                    android:layout_width="match_parent"
                    android:layout_height="40dp"
                    android:layout_marginLeft="4dp"
                    android:background="#ffffff"
                    android:gravity="left|center"
                    android:paddingLeft="10dp"
                    android:text="To Account"
                    android:textColor="@color/loginBtnBG"
                    android:textStyle="bold" />

                <TextView
                    android:layout_width="match_parent"
                    android:layout_height="1.5dp"
                    android:layout_marginLeft="4dp"
                    android:background="@color/black" />


                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="4dp"
                    android:background="#ffffff"
                    android:orientation="vertical"
                    android:paddingTop="4dp"
                    android:paddingBottom="4dp"
                    android:paddingRight="4dp">


                    <com.weiwangcn.betterspinner.library.BetterSpinner
                        android:id="@+id/ownAccFToAccountSpinner"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:hint="Select To Account"
                        android:paddingLeft="10dp"
                        android:textSize="14sp" />

                    <include layout="@layout/inc_ft_to_acc_info" />

                </LinearLayout>
            </LinearLayout>
            <include layout="@layout/inc_ft_input_info" />
        </LinearLayout>
    </android.support.v4.widget.NestedScrollView>

    <ScrollView
        android:id="@+id/sectionConfirmationDetails"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_below="@+id/ftBtnGroup"
        android:visibility="gone">

        <include layout="@layout/inc_ft_confirmation_details" />
    </ScrollView>

    <include
        layout="@layout/inc_otp_input_form"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="20dp"
        android:layout_marginLeft="10dp"
        android:layout_marginRight="10dp"
        android:layout_below="@+id/ftBtnGroup" />

    <include
        layout="@layout/inc_ft_success"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_below="@+id/ftBtnGroup" />

    <ScrollView
        android:id="@+id/sectionAddFavorite"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_below="@+id/ftBtnGroup"
        android:visibility="gone">

        <include
            layout="@layout/dialog_add_within_ft_favorite"
            android:layout_width="match_parent"
            android:layout_height="match_parent" />
    </ScrollView>


</RelativeLayout>
</android.support.design.widget.CoordinatorLayout>

Exceptions are

E/AndroidRuntime: FATAL EXCEPTION: main
              java.lang.RuntimeException: Unable to start activity ComponentInfo{com.brainstation.ib.abbl/com.brainstation.ib.abbl.ui.activities.OwnAccountFundTransferActivity}: android.view.InflateException: Binary XML file line #89: Error inflating class <unknown>
                  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)
                  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
                  at android.app.ActivityThread.access$600(ActivityThread.java:130)
                  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
                  at android.os.Handler.dispatchMessage(Handler.java:99)
                  at android.os.Looper.loop(Looper.java:137)
                  at android.app.ActivityThread.main(ActivityThread.java:4745)
                  at java.lang.reflect.Method.invokeNative(Native Method)
                  at java.lang.reflect.Method.invoke(Method.java:511)
                  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
                  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
                  at dalvik.system.NativeStart.main(Native Method)
               Caused by: android.view.InflateException: Binary XML file line #89: Error inflating class <unknown>
                  at android.view.LayoutInflater.createView(LayoutInflater.java:613)
                  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:687)
                  at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
                  at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
                  at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
                  at android.view.LayoutInflater.parseInclude(LayoutInflater.java:830)
                  at android.view.LayoutInflater.rInflate(LayoutInflater.java:736)
                  at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
                  at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
                  at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
                  at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
                  at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
                  at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
                  at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:284)
                  at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
                  at com.brainstation.ib.abbl.ui.activities.OwnAccountFundTransferActivity.onCreate(OwnAccountFundTransferActivity.java:275)
                  at android.app.Activity.performCreate(Activity.java:5008)
                  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
                  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
                  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084) 
                  at android.app.ActivityThread.access$600(ActivityThread.java:130) 
                  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195) 
                  at android.os.Handler.dispatchMessage(Handler.java:99) 
                  at android.os.Looper.loop(Looper.java:137) 
                  at android.app.ActivityThread.main(ActivityThread.java:4745) 
                  at java.lang.reflect.Method.invokeNative(Native Method) 
                  at java.lang.reflect.Method.invoke(Method.java:511) 
                  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786) 
                  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 
                  at dalvik.system.NativeStart.main(Native Method) 
               Caused by: java.lang.reflect.InvocationTargetException
                  at java.lang.reflect.Constructor.constructNative(Native Method)
                  at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
                  at android.view.LayoutInflater.createView(LayoutInflater.java:587)
                  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:687) 
                  at android.view.LayoutInflater.rInflate(LayoutInflater.java:746) 
                  at android.view.LayoutInflater.rInflate(LayoutInflater.java:749) 
                  at android.view.LayoutInflater.rInflate(LayoutInflater.java:749) 
                  at android.view.LayoutInflater.parseInclude(LayoutInflater.java:830) 
                  at android.view.LayoutInflater.rInflate(LayoutInflater.java:736) 
                  at android.view.LayoutInflater.rInflate(LayoutInflater.java:749) 
                  at android.view.LayoutInflater.rInflate(LayoutInflater.java:749) 
                  at android.view.LayoutInflater.rInflate(LayoutInflater.java:749) 
                  at android.view.LayoutInflater.inflate(LayoutInflater.java:489) 
                  at android.view.LayoutInflater.inflate(LayoutInflater.java:396) 
                  at android.view.LayoutInflater.inflate(LayoutInflater.java:352) 
                  at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:284) 
                  at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140) 
                  at com.brainstation.ib.abbl.ui.activities.OwnAccountFundTransferActivity.onCreate(OwnAccountFundTransferActivity.java:275) 
                  at android.app.Activity.performCreate(Activity.java:5008) 
                  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079) 
                  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023) 
                  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084) 
                  at android.app.ActivityThread.access$600(ActivityThread.java:130) 
                  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195) 
                  at android.os.Handler.dispatchMessage(Handler.java:99) 
                  at android.os.Looper.loop(Looper.java:137) 
                  at android.app.ActivityThread.main(ActivityThread.java:4745) 
                  at java.lang.reflect.Method.invokeNative(Native Method) 
                  at java.lang.reflect.Method.invoke(Method.java:511) 
                  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786) 
                  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 
                  at dalvik.system.NativeStart.main(Native Method) 
               Caused by: java.lang.NumberFormatException: Invalid long: "red"
                  at java.lang.Long.invalidLong(Long.java:125)
                  at java.lang.Long.parse(Long.java:362)
                  at java.lang.Long.parseLong(Long.java:353)
                  at com.android.internal.util.XmlUtils.parseUnsignedIntAttribute(XmlUtils.java:164)
                  at com.android.internal.util.XmlUtils.convertValueToUnsignedInt(XmlUtils.java:132)
                  at android.content.res.StringBlock.applyStyles(StringBlock.java:239)
                  at android.content.res.StringBlock.get(StringBlock.java:133)
                  at android.content.res.AssetManager.getPooledString(AssetManager.java:274)
                  at android.content.res.TypedArray.loadStringValueAt(TypedArray.java:726)
                  at android.content.res.TypedArray.getText(TypedArray.java:96)
                  at android.widget.TextView.<init>(TextView.java:698)
                  at android.support.v7.widget.AppCompatTextView.<init>(AppCompatTextView.java:59)
                  at android.support.v7.widget.AppCompatTextView.<init>(AppCompatTextView.java:55)
                  at java.lang.reflect.Constructor.constructNative(Native Method) 
                  at java.lang.reflect.Constructor.newInstance(Constructor.java:417) 
                  at android.view.LayoutInflater.createView(LayoutInflater.java:587) 
                  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:687) 
                  at android.view.LayoutInflater.rInflate(LayoutInflater.java:746) 
                  at android.view.LayoutInflater.rInflate(LayoutInflater.java:749) 
                  at android.view.LayoutInflater.rInflate(LayoutInflater.java:749) 
                  at android.view.LayoutInflater.parseInclude(LayoutInflater.java:830) 
                  at android.view.LayoutInflater.rInflate(LayoutInflater.java:736) 
                  at android.view.LayoutInflater.rInflate(LayoutInflater.java:749) 
                  at android.view.LayoutInflater.rInflate(LayoutInflater.java:749) 
                  at android.view.LayoutInflater.rInflate(LayoutInflater.java:749) 
                  at android.view.LayoutInflater.inflate(LayoutInflater.java:489) 
                  at android.view.LayoutInflater.inflate(LayoutInflater.java:396) 
                  at android.view.LayoutInflater.inflate(LayoutInflater.java:352) 
                  at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:284) 
                  at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140) 
                  at com.brainstation.ib.abbl.ui.activities.OwnAccountFundTransferActivity.onCreate(OwnAccountFundTransferActivity.java:275) 
                  at android.app.Activity.performCreate(Activity.java:5008) 
                  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079) 
                  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023) 
                  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084) 
                  at android.app.ActivityThread.access$600(ActivityThread.java:130) 
                  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195) 
                  at android.os.Handler.dispatchMessage(Handler.java:99) 
                  at android.os.Looper.loop(Looper.java:137) 
                  at android.app.ActivityThread.main(ActivityThread.java:4745) 
                  at java.lang.reflect.Method.invokeNative(Native Method) 
                  at java.lang.reflect.Method.invoke(Method.java:511) 
                  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786) 
                  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 
                  at dalvik.system.NativeStart.main(Native Method) 

The code is successfully in running > API 20.

When I am going to run in kitkat then app is crashed. Is there any problem in my XML file ?

1
  • Read the rest of the exception NumberFormatException: Invalid long: "red" Commented Nov 27, 2016 at 11:10

2 Answers 2

1

You need to provide Color Code or Color Tag Instead of Color Name, Your Logs Says so.

Caused by: java.lang.NumberFormatException: Invalid long: "red"

Sign up to request clarification or add additional context in comments.

4 Comments

I used color code everywhere. Where I user "red" instead of color code ?
Please read out your logs, you'll find that line also with a hyperlink to browse that class or that point. if you don't find that anymore clean your project and rebuild it.
Yeah I clean it and rebuild also but still problem is there...Code is working on lollipop and upper version but not work in lower versions.
Oh yeah I got it, I used "red" in my string.xml. <string name="narrationHint">Narration <font fgcolor="red">*</font> </string> Now I put hexadecimal color code instead of "red". Thank you.
0

Looking at your XML, you have forgot to declare your namespace in the beginning of your layout (RelativeLayout)

xmlns:android="http://schemas.android.com/apk/res/android"

here

<?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="#dddddd">

Hope it helps, Cheers!

1 Comment

It's there. The question wasn't formatted correctly

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.