分享

android报错 XML or text declaration not at start of entity.

 悟道习术 2021-02-19

AAPT: error: XML or text declaration not at start of entity.\n    ","tool":"AAPT"

上述报错在修改了 xml布局后出现此情况,于是进入相应的布局文件下查看,如下:  

<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:layout_height="match_parent"
xmlns:android="http://schemas./apk/res/android"
android:layout_width="match_parent">
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="60dp"
android:background="@drawable/shape_corner_down"
/>
</LinearLayout>

比较发现,其<?xml version="1.0" encoding="utf-8"?>出现了两次,将其中之一删除后,再次sync,完全正常。

以上也许对你有所帮助。

    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多