[Android] Android Build 时报错: java.io.IOException: Could not parse XML from android/accounts/annotations.xml

Android构建时报错:

app:lintVitalRelease[Fatal Error] :3:214: 与元素类型 “item” 相关联的 “name” 属性值不能包含 ‘<’ 字符。

Could not read /Users/panxin/Library/Android/sdk/platform-tools/api/annotations.zip

java.io.IOException: Could not parse XML from android/accounts/annotations.xml

原因:sdk下/platform-tools/api/annotations.zip这个文件里的xml文件不规范造成的。

解决方法:

    到sdk目录下找到/platform-tools/api/annotations.zip这个文件并解压。

    用记事本打开以下两个文件,并且把标签内的 ‘<’ 和 ‘>’ 字符分别替换成 "&lt;” 和 “&gt;”。

    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

    保存并压缩,替换掉原来的annotations.zip文件。

本博客地址: wukong1688

本文原文地址:https://www.cnblogs.com/wukong1688/p/10773419.html

转载请著名出处!谢谢~~

原文地址:https://www.cnblogs.com/wukong1688/p/10773419.html