Home » Android » android – r.string error "cannot be resolved or is not a field"

android – r.string error "cannot be resolved or is not a field"

Posted by: admin June 15, 2020 Leave a comment

Questions:

I just opened an older android app project and all of a sudden numerous R.string._var_Name errors were found. If I add “import android.R” then the _var_name becomes an issue saying “cannot be resolved or is not a field”. The translation is in /res/values/strings.xml . Any ideas why the error exists?

How to&Answers:

In my case import android.R was usually the problem. I then removed it and build again (eclipse) and than it worked. Cleaning the project often helps too.

Answer:

If your class files are not in your root package, you’ll need to import them at the top of your file like this:

your.package.name.R

Answer:

Go to Project>Properties>Builders and see if ‘Android Resource Manager’ is checked.
Or go to Project and do ‘Clean’ to rebuild the project.

Answer:

I had that problem when modify the samples of vuforia. I resolved that adding the string name=... necessary in the file strings.xml file.