简体   繁体   English

错误“无法解析符号R”

[英]Error “Cannot Resolve Symbol R ”

My Android Studio is keep on giving error Cannot Resolve Symbol R . 我的Android Studio持续显示错误无法解析Symbol R。 It is a file in Android Directory named as R.java . 这是Android目录中名为R.java的文件。 I Have this file safely in the Directory. 我将此文件安全地保存在目录中。 But still, it is Showing Error. 但是,它仍然显示错误。 After Searching for this error on internet, People Suggest me to do Rebuild/Clean/Gradle Project Sync/Restart Android Studio and other methods. 在互联网上搜索此错误后,人们建议我进行重建/清理/ Gradle项目同步/重新启动Android Studio等方法。 I Did Everything. 我做了一切。 But still, Problem is there! 但是,问题仍然存在! What To Do?? 该怎么办??

This sometimes happens if there's an error in one or more resource files (xml). 如果一个或多个资源文件(xml)中存在错误,则有时会发生这种情况。 Check your layout files and files in the values folder for errors. 检查布局文件和values文件夹中的文件是否有错误。 Check the AndroidManifest file as well. 还要检查AndroidManifest文件。

Android Studio is based on IntelliJ; Android Studio基于IntelliJ; therefore, there are some things that you can try to solve your issues. 因此,有些事情您可以尝试解决您的问题。

  • Try to Sync your project: Go to File, Click on Sync Project with Gradles File 尝试同步项目:转到文件,单击将项目与Gradles文件同步
  • Try to Invalidate the Cache: Go to File, Click on Invalidate Caches / Restart... 尝试使缓存无效:转到文件,单击“使缓存无效/重新启动...”。

Let me know if this works for you in case we need to try something else. 让我知道这是否对您有用,以防万一我们需要尝试其他方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM