cannot resolve R

+2 Bruce Cheung · January 9, 2015
I installed Android SDK and all the necessary package on SDK manager . However , there is an error popped up on my MainActivity.java saying Cannot resolve R. What should I do with that ?

Post a Reply

Replies

Oldest  Newest  Rating
0 radhesh r · January 9, 2015
First you may clean the project, then run the project.
0 Bruce Cheung · January 9, 2015
Is there any other way ? that seems doesn't work for me 
0 radhesh r · January 10, 2015
1)If you are using  Eclipse, sometimes Eclipse likes to add an "import android.R" statement at the top of your files that use resources, especially when you ask Eclipse to sort or otherwise manage imports. This will cause yourmake to break. Look out for these erroneous import statements and delete them... Ctrl + Shift + O command to "Organize Imports" and generate any missing import statements.
2) Check for the  /res directory and there must be some file that have some error in it and that is preventing the application from being built. For example, it may be a layout file or it may be due to some missing resource is, but you already defined it in the XML file.
3)Make sure you have updated the SDK  

if the problem is recreated than >post here again and we'll go into more detail.
0 Bruce Cheung · January 12, 2015
the problem has resolved , thank you
0 radhesh r · January 14, 2015
welcum-)
  • 1

Java / Android Development

106,964 followers
About

Very popular language used to create desktop applications, website applets, and Android apps.

Links
Moderators
Bucky Roberts Administrator