Sunday, 2 April 2017

Solve Couldn't resolve resource @string/your_text warning


resolve-Couldn't-resolve-resource-@string/your_text


Many of the beginners will find this error  Couldn't resolve resource @string/your_text , while you are trying to change the text hello_world in the activity_main.xml in the following line like this:




The actual coding will be like the above image but the beginner will try to change the hello_world like this:


The text may be anything , here i am using Welcome.

the error will come like this :


Why this is error is coming means , the @string/ resembles the string.xml under the values folder under the res folder  which i have discussed in the previous post.

Read here:

Project Structures in Android Eclipse

In order to add a new text we need to add the text in that string.xml folder.

Follow the following steps :

1.Open  res ----> values ----> string.xml 





In this add a new line as follows:

 <string name="welcome">Welcome</string>


Now save both string.xml and activty_main.xml and now see the error will be gone.


Thus the error   Couldn't resolve resource @string/your_text was successfully cleared.

read here:

Hello World app in Android