Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse could not resolve string resource error

I just created a new android project and prepared the basic structure for it. Eclipse is telling me that it couldn't resolve any strings, even the standard "hello" or "app_name" strings :O Restarting the IDE didn't help. Any suggestions? A screenshot can be found here

like image 788
Droidman Avatar asked Feb 11 '12 14:02

Droidman


People also ask

What is string resource?

A string resource provides text strings for your application with optional text styling and formatting. There are three types of resources that can provide your application with strings: String. XML resource that provides a single string.

What is strings xml?

String. xml file contains all the strings which will be used frequently in Android project. String. xml file present in the values folder which is sub folder of res folder in project structure.In Android Studio, we have many Views such as TextView,Button,EditText,CheckBox,RadioButton etc.

What does it mean when something Cannot be resolved to a type?

"cannot be resolved to a type" means that the compiler has decided that, according to the syntax of the language, what it found at this place in the code has to be type, which means either a class, an interface, or a primitive tpye, but cannot find the definition of any type with that name.

Where is the strings xml file located?

The XML resource files containing localized strings are placed in subfolders of the project's res folder. Android uses a special folder-naming scheme to automatically choose the correct localized resources—for example, the folder values-fr would contain a strings.


1 Answers

I noticed that in your project, there is no values resource folder. The resource in the folder with the suffix of -de,-en will be applied when the language on the device is German, UK, but the default folder should not be deleted. Try to add the values folder and corresponding string.xml to the project.

like image 103
Huang Avatar answered Oct 06 '22 01:10

Huang