android.view.InflateException:二进制XML文件行#89:错误输出类<unknown>

时间:2016-11-27 10:58:59

标签: android

我收到错误,因为android.view.InflateException:二进制XML文件行#89:错误膨胀类。此前此活动运行良好。但突然得到这个错误。多次清理项目。但是没有用。

  

我的XML文件是:

<?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>

例外情况

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) 

代码已成功运行&gt; API 20。

当我要在kitkat中运行时,应用程序崩溃了。 我的XML文件有问题吗?

2 个答案:

答案 0 :(得分:1)

您需要提供颜色代码颜色标记,而不是颜色名称,您的日志是这样说的。

  

引起:java.lang.NumberFormatException:无效的长:&#34;红色&#34;

答案 1 :(得分:0)

查看XML,您忘记在布局的开头声明您的命名空间(RelativeLayout)

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

这里

<?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">

希望它有所帮助,干杯!