微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

错误:(2)解析XML时出错:XML或文本声明不在实体android studio的开头

当我试图运行它时,我刚从另一个程序员那里拿了这个应用程序,它给了我一个错误说:

Error:(2) Error parsing XML: XML or text declaration not at start of entity

Error:Execution Failed for task ‘:app:processDebugResources’.
com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process ‘command ‘C:\Users\ahmad\AppData\Local\Android\sdk\build-tools\21.1.2\aapt.exe” finished with non-zero exit value 1

这是代码

<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="6dip" >
<TextView
    android:id="@+id/userid"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:paddingTop="6dip"
    android:paddingLeft="6dip"
    android:textSize="17sp"
    android:textStyle="bold"
    android:visibility="gone"
    />
<CheckBox
    android:id="@+id/checkBox1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:focusable="false"
    android:focusableInTouchMode="false"
    android:text="CheckBox" />
<TextView
    android:id="@+id/fullname"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignBaseline="@+id/checkBox1"
    android:layout_alignBottom="@+id/checkBox1"
    android:layout_toRightOf="@+id/checkBox1"
    android:text="TextView" />
 </RelativeLayout>

解决方法

这是错误所讨论的XML文本声明:

<?xml version="1.0" encoding="utf-8"?>

您在文件顶部有两个.删除一个,该错误应该消失.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。