aapt:错误:格式不正确(无效令牌)

yrdbyhpb  于 2021-06-30  发布在  Java
关注(0)|答案(1)|浏览(450)

我正在开发一个应用程序,使用以下xml。这是我的登录片段的xml。但是,当我尝试清理/构建项目时,会出现以下错误:
错误:分析xml时出错:格式不正确(无效标记)

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

可能是什么意思?我做错了什么?我真的很担心。我已经检查了我的代码很多次,但没有找到错误

pxy2qtax

pxy2qtax1#

文件的倒数第二行

</>

这会导致xml文件的格式不正确。把它改成

</androidx.constraintlayout.widget.ConstraintLayout>

正确关闭同名的上一个开始标记。

相关问题