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

查看:45
本文介绍了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文件夹
  • 为布局和包选择不同的名称
  • 重启电脑
  • 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

推荐答案

Android Studio 不需要重新安装:关闭它并删除文件夹 .AndroidStudioX.Y(X 和Y 取决于您的 Android Studio 版本)在用户文件夹中.

You don't need to reinstall Android Studio: close it and delete the folder .AndroidStudioX.Y (X and Y depend on your Android studio version) in the user folder.

答案很旧,但我今天在 Android Studio 3.3.2 上遇到了同样的问题.我给出我的答案,希望它可以帮助其他开发人员.随机方式,Android studio 无法打开某些文件.首先,我认为文件已损坏.使用外部编辑器打开同一个文件后,我意识到这不是真的.

The answer is old, but I have the same problem today with Android Studio 3.3.2. I give my answer with the hope it can help other developers. In a random way, Android studio cannot open some files. In the first instance, I thought that the files were corrupted. After opening the same file with an external editor I realized that is not true.

在上面的例子中,.iml 文件不能被 Android Studio 读取.我用 Notepad++ 打开同一个文件,幸运的是我看到那个文件很好.

In the above example, the .iml file cannot be read by Android Studio. I open the same file with Notepad++ and I luckily saw that file was good.

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

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