1

I have the following problem:

Rendering Problems Couldn't resolve resource @string/add_new_todo_item_string

I'm trying to use a string resource in a Textview. These are my XML files.

<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/footerView"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:gravity="center_horizontal"
    android:text="@string/add_new_todo_item_string"
    android:textSize="24sp" >

</TextView>

XML file for string resources:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="app_name">UILabs</string>
    <string name="done_string">Done:</string>
    <string name="priority_string">Priority:</string>
    <string name="date_string">Date:</string>
    <string name="add_new_todo_item_string">Add New ToDo Item</string>
    <string name="title_string">Title</string>
    <string name="status_string">Status</string>
    <string name="not_done_string">Not Done</string>
    <string name="priority_low_string">Low</string>
    <string name="priority_medium_string">Medium</string>
    <string name="priority_high_string">High</string>
    <string name="time_and_date_string">Time and Date</string>
    <string name="no_date_set_string">0000&#8211;00&#8211;00</string>
    <string name="no_time_set_string">00:00:00</string>
    <string name="choose_date_string">Choose Date</string>
    <string name="choose_time_string">Choose Time</string>
    <string name="cancel_string">Cancel</string>
    <string name="reset_string">Reset</string>
    <string name="submit_string">Submit</string>
    <string name="enter_title_string">Enter Title</string>

</resources>

What I'm missing? Thanks for your help.

EDIT: I also have a problem with mi AndroidMAnifest.xml file

Cannot resolve symbol '@string/app_name' less... (Ctrl+F1) Validates resource references inside Android XML files.

This is my androidManifest file:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="course.labs.todomanager"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="14"
        android:targetSdkVersion="19" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" >
        <activity
            android:name=".ToDoManagerActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name=".AddToDoActivity" >
        </activity>
    </application>

</manifest>

And the error is in the following lines

android:icon="@drawable/ic_launcher"
android:label="@string/app_name" 
android:label="@string/app_name" >
Juan David
  • 2,676
  • 4
  • 32
  • 42

3 Answers3

7

Sometime it happens in Android Studio. So Please Clean Your Project & Rebuild

Build > Clean Project Then Build > Rebuild Project

Then Click Invalidate Caches/Restart Options

IntelliJ Amiya
  • 74,896
  • 15
  • 165
  • 198
3

Try File -> Invalidate Caches/Restart

David C Adams
  • 1,953
  • 12
  • 12
0

The Android studio configures for multi-language support to the strings you mention. In order to resolve it follow the below steps,

  1. In android studio, Right click the strings.xml under values folder.
  2. Click on the Open Translations Editor
  3. You can see the key value and the default value as app_name and your app name respectively.
  4. Click the + on the left corner of the Translatons Editor.
  5. In the new pop-up window, Enter all your key values and default values as like you mentioned in the strings.xml.
  6. Now check the xml files, All your issues are resolved.
Sabarish
  • 1,184
  • 3
  • 14
  • 35