0

I am having trouble with my R file, I was able to get it running again but then i seem to have another issue. Nothing seems to be generating after all the work I put into it. I think my problem is coming from the fact that my src cannot see the xml files and I don't know why. My find_bluetooth_devices is underlined in red squiggles and says it cannot be resolved or is not a field. However, I know for sure that I have created a xml file that included everything for it to work. I feel as though the xml file is not being seen by the src as it should be. Does anyone know what I can do in order for the src file to see my xml file?

 setContentView(R.layout.find_bluetooth_devices);
meh
  • 59
  • 6
  • These answers are good. See also [Developing for Android in Eclipse: R.java not generating](http://stackoverflow.com/questions/2757107/developing-for-android-in-eclipse-r-java-not-generating). – hotshot309 Jan 18 '12 at 22:16

5 Answers5

1

Make sure your import statement is for the correct R file. You could have mistakenly imported android.R instead of your projects R file.

Rich
  • 36,270
  • 31
  • 115
  • 154
1

Here, read through this and the next one and see if you can solve the problem:

Also, make sure you dont have import android.R at the top.

Where did my R file go?

Vic Vuci
  • 6,993
  • 6
  • 55
  • 90
1

Try cleaning the project

Project>Clean
Jrom
  • 849
  • 1
  • 10
  • 19
0

There are two things that can cause that:

  1. There's a syntax error in one of your XML files, this causes the R file to not be generated.
  2. The R file is not included in your class, make sure you import com.yourproject.R in the class.
Rotemmiz
  • 7,933
  • 3
  • 36
  • 36
0
  1. Clean your project the project will rebuild and R.java generated

  2. Change the compiler the project will rebuild and R.java generated

  3. Create New Project and copy all java file and resources into new project

dilipkaklotar
  • 1,469
  • 3
  • 20
  • 28