MS Tabrez
MS Tabrez

Reputation: 5

What is the main cause for a reference error?

i am trying to run my program but facing an error problem.it is indicating an error sign under the R of my reference statement. what are the facts that can create this kind of errors ?

Upvotes: 0

Views: 42

Answers (1)

hasanghaforian
hasanghaforian

Reputation: 14032

R is an auto generate file.Problems occur if it does not generate or you did not reference to it correctly:

  1. It may be caused if a file name in your /res folder be invalid;so R does not generate.

  2. It may raised if you try to reference to R in a package that is not main package.

  3. In your imports of your class,you may see import android.R; change it to import your.package.name.R;

  4. It may be caused by an error in your resources.For example an error in XML layout or strings file.

  5. You can do closing and reopening your project or going to >Project > Build all (and selecting "Build Automatically").It may be fix the problem.

It is recommended to see R cannot be resolved - Android error.

Upvotes: 1

Related Questions