[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这个文件并解压。
用记事本打开以下两个文件,并且把标签内的 ‘<’ 和 ‘>’ 字符分别替换成 "<” 和 “>”。
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文件。
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步