-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
  • 16,194
  • 20
  • 64
  • 81
jaisonDavis
  • 1,407
  • 2
  • 22
  • 36

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
  • 29,001
  • 6
  • 52
  • 53
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
  • 16,194
  • 20
  • 64
  • 81
pixelscreen
  • 1,945
  • 2
  • 18
  • 40
0

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

Try clean the project or do a manual import.

Nikhil
  • 16,194
  • 20
  • 64
  • 81
Guanlun
  • 1,598
  • 2
  • 18
  • 29