解析XML时出错:XML格式不正确(无效令牌)

时间:2016-10-03 14:33:52

标签: java android xml xml-parsing well-formed

我在构建项目时经常遇到此错误:

AGPBI: {"kind":"error","text":"Error parsing XML: not well-formed (invalid token)","sources":[{"file":"D:\\MyApp\\app\\src\\main\\res\\layout\\login_help.xml","position":{"startLine":0}}],"original":"","tool":"AAPT"}

D:\MyApp\app\src\main\res\layout\login_help.xml Error:(1) Error parsing XML: not well-formed (invalid token)

我尝试搜索xml错误,但我无法找到任何错误。我在stackoverflow上找到的任何答案都没有帮助:(。如何解决这个无意义的错误?

login_help.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:weightSum="1">

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_gravity="center_horizontal">

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="@string/login_help_descriptie_1"
            android:id="@+id/textView3"
            android:layout_gravity="center_horizontal"
            android:layout_alignParentTop="true"
            android:layout_centerHorizontal="true"
            android:layout_marginBottom="10dp" />

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="@string/login_help_descriptie_2"
            android:id="@+id/textView4"
            android:layout_gravity="center_horizontal"
            android:layout_below="@+id/textView3"
            android:layout_alignParentLeft="true"
            android:layout_alignParentStart="true"
            android:layout_marginBottom="10dp" />

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="@string/login_help_descriptie_3"
            android:id="@+id/textView5"
            android:layout_gravity="center_horizontal"
            android:layout_below="@+id/textView4"
            android:layout_alignParentLeft="true"
            android:layout_alignParentStart="true"
            android:layout_marginBottom="10dp" />

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="@string/login_help_descriptie_4"
            android:layout_below="@+id/textView5"
            android:layout_gravity="center_horizontal"
            android:layout_centerVertical="true"
            android:layout_centerHorizontal="true" />
    </RelativeLayout>
</LinearLayout>

有类似未答复的人question

1 个答案:

答案 0 :(得分:0)

遗憾的是,图片损坏了