Search code examples
javaandroidxmlxml-parsingwell-formed

Error parsing XML: not well-formed (invalid token) while XML is just perfectly fine


I am constantly getting this error while building a project:

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)

I tried searching for xml errors, but I just couldn't find any. Any answer I found on stackoverflow didn't help either :(. How can I fix this nonsense error?

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>

People with similar unanswered question


Solution

  • Caused by a corrupt image unfortunately