Android Studio制作损坏的Colors.xml,然后发生未知错误 [英] android studio makes corrupted Colors.xml, then unknown errors occur

查看:276
本文介绍了Android Studio制作损坏的Colors.xml,然后发生未知错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近我正在与我的android studio一起工作,没有问题,在我尝试向项目中添加新库后,我的项目突然开始出现随机错误(关于我的资源).

Recently I was working with my android studio with no problems, suddenly my project started giving random errors(about my resources) after I tried to add a new library to my project.

我彻底清理了磁带库,但是什么都没修好 我想做一个新项目,遇到新的错误

I completely cleaned the library but nothing got fixed, at all I wanted to make a new project, and faced new errors

colors.xml:1:1: Error: Content is not allowed in prolog.

Android Studio为colors.xml制作了一个这样的损坏文件:

Android studio made a corrupted file like this for colors.xml:

����   3      area I ConstantValue   length  
temperature  weight  
<init> ()V Code LineNumberTable LocalVariableTable this array 
InnerClasses ,Lcom/example/a

当我修复此xml时,另一个错误:

When I fixed this xml, another error:

Android resource compilation failed
ic_launcher_round.xml:1: error: not well-formed (invalid token).
aapt2.exe compile --legacy \

我尝试过:

  • 使缓存/重启无效
  • 删除我的C:\ Users中的.gradle文件夹
  • 重新下载gradle
  • 删除项目的gradle文件夹
  • 为布局和软件包选择不同的名称
  • 重新启动PC
  • 5小时谷歌搜索(无结果)

然后按要求输入ic_launcher_round.xml:

And ic_launcher_round.xml as asked:

����   3 �  � � � 0abc_background_cache_hint_selector_material_dark 
I ConstantValue   1abc_background_cache_hint_selector_material_light  
(abc_btn_colored_borderless_text_material  
abc_btn_colored_text_material  abc_color_highlight_material

推荐答案

这是许多开发人员报告的已知错误,而我已经遇到过一次.

This is a known bug which reported by many developers and I've faced that once.

唯一的解决方法是重新安装Android Studio或下载新版本的IDE,但是 在重新安装或更新旧配置时不要导入旧配置 .

The only fix is to reinstall the Android Studio or downloading the new version of the IDE but, don't import the old config when you reinstall or updating it.

请注意,将设置中的File-Encoding更改为UTF-8System Default也不起作用.

To be clear, changing File-Encoding in settings to UTF-8 or System Default doesn't work either.

这篇关于Android Studio制作损坏的Colors.xml,然后发生未知错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆