Android Studio 構建時報錯:與元素類型 “item” 相關聯的 “name” 屬性值不能包含 '小於號' 字符

報錯原因:

sdk 下的 /platform-tools/api/annotations.zip 這個文件裏的 xml 文件不規範造成的。

解決辦法:

  1. 到 sdk 目錄下找到 /platform-tools/api/annotations.zip 這個文件並解壓
  2. 用文本編輯器(推薦 Notepad++ )打開以下的所有文件
    並且把標籤內的 “<” 和 “>” 字符分別替換成 "<” 和 “>”
  • android/accounts/annotations.xml
  • android/hardware/camera2/annotations.xml
  • android/hardware/camera2/params/annotations.xml
  • android/app/slice/annotations.xml
  • android/widget/annotations.xml
  • android/view/annotations.xml
  • android/view/textclassifier/annotations.xml
  • android/bluetooth/le/annotations.xml
  • android/media/annotations.xml
  • android/preference/annotations.xml
  • android/text/annotations.xml
  1. 保存並壓縮,替換掉原來的annotations.zip文件

覺得改着太累的話,我這裏有改好的 annotations.zip

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章