Android studio 突然无法解析符号R [英] Android studio suddenly cannot resolve symbol R

查看:56
本文介绍了Android studio 突然无法解析符号R的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Android Studio 中打开了一个项目.它由向导生成并且运行良好.

I was having a project open in Android studio. It was generated by the wizard and working fine.

我对 activity_main.xml 做了一些小的改动,当我改回 MainActivity.java 时,我在几个地方收到了它无法解析 R 的错误.我可能做了一些事情来导致这个.但我不确定是什么,因为它在我编辑 xml 时出现.

I did some small changes to activity_main.xml and when I changed back to MainActivity.java i get the error in several places that it cannot resolve R. I might have done something to cause this. But I´m not sure what since it appered when I edited the xml.

有谁知道解决这个问题的方法是什么?我可以在 r/release/packege/com/中找到 R.java,它看起来不错.

Does anyone know what might be the solution to this? I can find the R.java in r/release/packege/com/ and it looks fine.

推荐答案

大多数时候是因为 XML 文件错误.XML 文件可以是布局文件、值文件或清单文件.请检查您的 xml 文件并尝试重建项目.有时清理项目并重建它也有效.

Most of the time it is due to a bad XML file. XML files can be layout files, value files, or the Manifest file. Please check your xml files and try to rebuild the project. Sometimes cleaning the project and rebuilding it also works.

这篇关于Android studio 突然无法解析符号R的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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