In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces the Android Studio 3.6 R.layout can not find the corresponding xml file how to solve the relevant knowledge, detailed and easy to understand, simple and fast operation, has a certain reference value, I believe that everyone read this Android Studio 3.6 R.layout can not find the corresponding xml file how to solve the article will have some gains, let's take a look at it.
In the new version of AndroidStudio 3.6, when creating an activity under the project package, the corresponding java and xml files will generally be generated at the same time. For example, when creating a MainActivity , MainActivity.java will be generated under the java package, and activity_main.xml will be generated in the layout file under the res folder.
However, after the actual creation, setContentView(R.layout.activity_main) in MainActivity.java; activity_main in this sentence will be marked red, and the corresponding error is activity_main.xml.
I found some solutions, usually saying that android.R is introduced in the java file header, and it needs to manually modify the R introduced into my own project, but I found that the R automatically introduced in my code is not wrong, it is the R of the project itself, and activity_main.xml does exist in the layout directory. There is also a clean project or rebuild project, but after trying it, I found that it did not work.
Later, after trying, I found that the problem is that the files in the current directory are not synchronized with the actual file system, that is, the current project directory needs to be refreshed after creation.
File->Sync with File System
Later, I tried several times and found that after creating activity, there was no such problem, which was a bit metaphysical. Because there are related problems on the Internet, but the reasons for the problems are different, it may be a version problem.
Record it here.
Knowledge point supplement: android development after the establishment of xml files in the class through R.layout can not find the corresponding xml file solution
Today, I encountered a headache when learning android development. I clearly have established xml files, but I can't find the corresponding files in the class through R.layout. Later, I found that when I wrote the code, I imported the R files of the system instead of the R files of my own projects through the shortcut alt+/. Therefore, I can't find the corresponding xml files in the class through R.layout. We should pay more attention to writing code later.
About "Android Studio 3.6 R.layout can not find the corresponding xml file how to solve" The content of this article is introduced here, thank you for reading! I believe everyone has a certain understanding of the knowledge of "how to solve the problem of R.layout not finding the corresponding xml file in Android Studio 3.6". If you still want to learn more knowledge, please pay attention to the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.