android渲染错误二进制XML文件行#-1:错误膨胀类未知

时间:2016-05-07 14:40:57

标签: android

我的android项目有问题,当我尝试添加日历视图或日期选择器时出现渲染问题消息

消息: " 渲染问题 渲染期间引发异常:二进制XML文件行#-1:错误 膨胀类未知> "

这是消息详情

java.lang.NoSuchFieldError: this$0
at android.view.ViewRootImpl$RunQueue.postDelayed(ViewRootImpl.java:6872)
at android.view.View.postDelayed(View.java:13008)
at android.widget.CalendarViewLegacyDelegate$ScrollStateRunnable.doScrollStateChange(CalendarViewLegacyDelegate.java:956)
at android.widget.CalendarViewLegacyDelegate.onScrollStateChanged(CalendarViewLegacyDelegate.java:829)
at android.widget.CalendarViewLegacyDelegate.goTo(CalendarViewLegacyDelegate.java:816)
at android.widget.CalendarViewLegacyDelegate.<init>(CalendarViewLegacyDelegate.java:334)
at android.widget.CalendarView.<init>(CalendarView.java:105)
at android.widget.CalendarView.<init>(CalendarView.java:92)
at android.widget.CalendarView.<init>(CalendarView.java:88)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at android.view.LayoutInflater.createView(LayoutInflater.java:619)
at android.view.BridgeInflater.onCreateView(BridgeInflater.java:107)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:694)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:762)
at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:149)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:835)
at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:70)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:811)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:838)
at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:70)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:811)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:838)
at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:70)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:811)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:838)
at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:70)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:811)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
at android.view.LayoutInflater.inflate(LayoutInflater.java:394)
at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:229)
at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:426)
at com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:350)
at com.android.tools.idea.rendering.RenderTask$2.compute(RenderTask.java:520)
at com.android.tools.idea.rendering.RenderTask$2.compute(RenderTask.java:508)
at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:967)
at com.android.tools.idea.rendering.RenderTask.createRenderSession(RenderTask.java:508)
at com.android.tools.idea.rendering.RenderTask.access$600(RenderTask.java:75)
at com.android.tools.idea.rendering.RenderTask$3.call(RenderTask.java:620)
at com.android.tools.idea.rendering.RenderTask$3.call(RenderTask.java:617)
at com.android.tools.idea.rendering.RenderService.runRenderAction(RenderService.java:371)
at com.android.tools.idea.rendering.RenderTask.render(RenderTask.java:617)
at com.android.tools.idea.rendering.RenderTask.render(RenderTask.java:639)
at com.intellij.android.designer.designSurface.AndroidDesignerEditorPanel$7.run(AndroidDesignerEditorPanel.java:519)
at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:337)
at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:327)
at com.intellij.util.ui.update.MergingUpdateQueue$3.run(MergingUpdateQueue.java:271)
at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:286)
at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:244)
at com.intellij.util.ui.update.MergingUpdateQueue.run(MergingUpdateQueue.java:234)
at com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:238)
at com.intellij.util.Alarm$Request$1.run(Alarm.java:352)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:695)

这是我的布局xml文件

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.laguses.callsrecorder.callsrecorderapp.Records">


<LinearLayout
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <LinearLayout
        android:orientation="horizontal"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:background="@color/backgroundcolor"
        android:paddingTop="20dp"
        android:paddingBottom="20dp"
        android:paddingLeft="15dp"
        android:paddingRight="15dp"
        android:gravity="center">

        <LinearLayout
            android:orientation="horizontal"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content">

            <ImageView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:id="@+id/imageView26"
                android:src="@mipmap/records_showfilter_icn" />
        </LinearLayout>

        <LinearLayout
            android:orientation="horizontal"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" >

            <ImageView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:id="@+id/imageView27"
                android:src="@mipmap/records_hidefilter_icn" />
        </LinearLayout>

        <LinearLayout
            android:orientation="horizontal"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:gravity="right">

            <LinearLayout
                android:orientation="horizontal"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:gravity="center">

                <EditText
                    android:layout_width="112dp"
                    android:layout_height="wrap_content"
                    android:id="@+id/editText"
                    android:singleLine="true"
                    android:textColor="#ffffff"
                    android:background="@drawable/search_field_borderstyle" />

                <ImageView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:id="@+id/imageView25"
                    android:src="@mipmap/records_search_icn"
                    android:layout_marginLeft="10dp" />
            </LinearLayout>
        </LinearLayout>

    </LinearLayout>

    <LinearLayout
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:padding="20dp"
        android:background="@color/backgroundcolor">

        <LinearLayout
            android:orientation="horizontal"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@drawable/filtergroupshape">

            <LinearLayout
                android:orientation="vertical"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content">

                <CheckBox
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Incoming Calls"
                    android:id="@+id/checkBox"
                    android:checked="false" />

                <CheckBox
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Outgoing Calls"
                    android:id="@+id/checkBox2"
                    android:checked="false" />

                <CheckBox
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Missed Calls"
                    android:id="@+id/checkBox3"
                    android:checked="false" />

                <CheckBox
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Fails Calls"
                    android:id="@+id/checkBox4"
                    android:checked="false" />

                <CheckBox
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Favorite Calls"
                    android:id="@+id/checkBox5"
                    android:checked="false" />
            </LinearLayout>

            <CalendarView
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:id="@+id/calendarView"
                android:layout_gravity="center_vertical" />

        </LinearLayout>
    </LinearLayout>

</LinearLayout>

最后我注意到只有在我尝试添加日历视图或日期选择器时才会出现错误

2 个答案:

答案 0 :(得分:0)

您缺少XML文件的字符编码,在声明元素之前添加行

 <?xml version="1.0" encoding="UTF-8"?>
 <RelativeLayout
 //Your XML code here

答案 1 :(得分:0)

&#13;
&#13;
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context="com.example.android.justjava.MainActivity">

    <TextView
        android:id="@+id/cobertura"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_margin="16dp"
        android:text="Coberturas"
        android:textAllCaps="true"
        android:textSize="16sp" />

    <CheckBox
        android:id="@+id/crema_checkbox"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:checked="false"
        android:text="Crema" />

    <TextView
        android:id="@+id/cantidad"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_margin="16dp"
        android:text="¿Cuantas tazas de café desea?"
        android:textAllCaps="true"
        android:textSize="16sp" />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:weightSum="1">

        <Button
            android:layout_width="48dp"
            android:layout_height="48dp"
            android:layout_marginLeft="16dp"
            android:onClick="decrecer"
            android:text="-" />

        <TextView
            android:id="@+id/cantidad_text_view"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="16dp"
            android:layout_weight="0.13"
            android:text="0"
            android:textColor="#000000"
            android:textSize="16dp" />

        <Button
            android:id="@+id/button"
            android:layout_width="48dp"
            android:layout_height="48dp"
            android:layout_marginLeft="16dp"
            android:onClick="incrementar"
            android:text="+" />

        <Button
            android:layout_width="wrap_content"
            android:layout_height="48dp"
            android:layout_marginLeft="32dp"
            android:onClick="submitOrder"
            android:text="ORDEN" />

    </LinearLayout>

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_margin="16dp"
        android:text="Orden de Pedido"
        android:textAllCaps="true"
        android:textSize="16sp" />

    <TextView
        android:id="@+id/orden_de_pedido_text_view"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginLeft="16dp"
        android:text="BsF 0"
        android:textColor="#000000"
        android:textSize="16dp" />

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="15dp"
        android:onClick="reiniciar"
        android:text="reinicio" />

</LinearLayout>
&#13;
&#13;
&#13;