-2

I am making an app in which I set an image as the background but when I set this image as the background the R.java file disappears and I get the "R cannot be resolve to a variable error"

EDIT:None of the usual "R cannot be resolved to a variable" solutions did not work

Any solutions?

Nikhil
  • 15,872
  • 20
  • 61
  • 80
jaisonDavis
  • 1,219
  • 2
  • 17
  • 32

3 Answers3

2

This problem mostly appear due to due to build path errors, to check problems see Eclipse Menu-> Windows -? Show View-> Error Logs and Eclipse Menu-> Windows -? Show View->Problems. and According the problem listed resolve the error, and then try to compile the project.

jeet
  • 27,861
  • 6
  • 48
  • 52
1

Maybe this will work. I'm not sure.

1. Change the name of the image(in drawable directory) you are trying to use.
2. Clean the project

Also, check your imports if u are importing android.R class instead of your own R.java class

Nikhil
  • 15,872
  • 20
  • 61
  • 80
pixelscreen
  • 1,897
  • 2
  • 16
  • 38
0

Are you importing android.R instead of your own R class?

Try clean the project or do a manual import.

Nikhil
  • 15,872
  • 20
  • 61
  • 80
Guanlun
  • 1,498
  • 2
  • 17
  • 29