I am working on an application, with following XML. This the XML of my Sign In Fragment. But when I try to clean/build my project the following error occurs:
error: Error parsing XML: not well-formed (invalid token)
<?xml version="1.0" encoding="utf-8"?> <FrameLayout 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" xmlns:app="http://schemas.android.com/apk/res-auto" tools:context=".SignInFragment" android:background="@drawable/gradient_color"> <androidx.constraintlayout.widget.ConstraintLayout android:layout_width="match_parent" android:layout_height="match_parent"> <ImageButton android:id="@+id/sign_up_close_btn" android:layout_width="50dp" android:layout_height="50dp" android:background="@android:color/transparent" android:padding="16dp" android:src="@drawable/ic_cancel" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintHorizontal_bias="1.0" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> <ImageView android:id="@+id/imageView" android:layout_width="254dp" android:layout_height="182dp" android:src="@mipmap/ic_launcher_foreground" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintHorizontal_bias="0.496" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" app:layout_constraintVertical_bias="0.16000003" /> <EditText android:id="@+id/sign_in_email" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginStart="16dp" android:layout_marginLeft="16dp" android:layout_marginTop="32dp" android:layout_marginEnd="16dp" android:layout_marginRight="16dp" android:backgroundTint="#70FFFFFF" android:textColor="@color/colorAccent" android:ems="10" android:hint="@string/hint_email" android:inputType="textEmailAddress" android:textColorHint="#70FFFFFF" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/imageView" /> <EditText android:id="@+id/sign_in_pass" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginStart="16dp" android:layout_marginLeft="16dp" android:layout_marginTop="32dp" android:layout_marginEnd="16dp" android:layout_marginRight="16dp" android:backgroundTint="#70FFFFFF" android:textColor="@color/colorAccent" android:ems="10" android:hint="@string/hint_pass" android:inputType="textPassword" android:textColorHint="#70FFFFFF" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/sign_in_email" /> <TextView android:id="@+id/sign_in_forgot_pass" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="4dp" android:layout_marginLeft="4dp" android:text="@string/forg_pass" android:textColor="@color/colorAccent" app:layout_constraintStart_toStartOf="@+id/sign_in_pass" app:layout_constraintTop_toBottomOf="@+id/sign_in_pass" /> <Button android:id="@+id/sign_in_btn" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginStart="16dp" android:layout_marginLeft="16dp" android:layout_marginEnd="16dp" android:layout_marginRight="16dp" android:background="@color/colorPrimary" android:text="@string/btn_In" android:textAllCaps="false" android:textColor="@color/colorAccent" android:textSize="16sp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintHorizontal_bias="0.0" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/sign_in_forgot_pass" app:layout_constraintVertical_bias="0.47000003" /> <TextView android:id="@+id/textView2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="16dp" android:text="@string/or" android:textColor="@color/colorAccent" app:layout_constraintBottom_toTopOf="@+id/tv_dont_have_an_account" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintHorizontal_bias="0.498" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/sign_in_btn" app:layout_constraintVertical_bias="0.0" /> <TextView android:id="@+id/tv_dont_have_an_account" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="24dp" android:text="@string/text1" android:textColor="@color/colorAccent" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" /> <View android:id="@+id/divider" android:layout_width="100dp" android:layout_height="1dp" android:layout_marginEnd="16dp" android:layout_marginRight="16dp" android:background="@color/colorAccent" app:layout_constraintBottom_toBottomOf="@+id/textView2" app:layout_constraintEnd_toStartOf="@+id/textView2" app:layout_constraintTop_toTopOf="@+id/textView2" /> <View android:id="@+id/divider2" android:layout_width="100dp" android:layout_height="1dp" android:layout_marginStart="16dp" android:layout_marginLeft="16dp" android:background="@color/colorAccent" app:layout_constraintBottom_toBottomOf="@+id/textView2" app:layout_constraintStart_toEndOf="@+id/textView2" app:layout_constraintTop_toTopOf="@+id/textView2" /> <ProgressBar android:id="@+id/sign_in_progress_bar" style="?android:attr/progressBarStyle" android:layout_width="30dp" android:layout_height="30dp" android:visibility="invisible" app:layout_constraintBottom_toTopOf="@+id/sign_in_btn" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/sign_in_pass" /> </> </FrameLayout>
What does it possibly mean? what i have done wrong? I’m really worried about this. i have go through my code many time but didn’t find the error
Advertisement
Answer
The second-to-last line of your file has
</>
which causes your XML file to be not well-formed. Change it to
</androidx.constraintlayout.widget.ConstraintLayout>
to properly close a previous opening tag of the same name.