Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ERROR: " Cannot resolve symbol '@string/edit_message' " Android Studio

Tags:

android

xml

I'm trying to follow the android tutorial on: http://developer.android.com/training/basics/firstapp/building-ui.html But when I reach the part where you have to add a button my Android Studio keeps returning this errors:

Cannot resolve symbol '@string/edit_message'
Cannot resolve symbol '@string/button_send'

XML Code:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="horizontal" >
    <EditText android:id="@+id/edit_message"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:hint="@string/edit_message" />
    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/button_send" />
</LinearLayout>

What am I doing wrong here? I can't find the right solution on other stackoverflow questions and I'm pretty sure i used the right code on the android tutorial from google.

like image 848
Stefan Avatar asked Jan 05 '15 11:01

Stefan


2 Answers

You must define those 2 strings in strings.xml

     <?xml version="1.0" encoding="utf-8"?>
    <resources>
      ...
        <string name="edit_message">something text /string>
        <string name="button_send">something text</string>
      ...
    </resources>
like image 106
Ivan Avatar answered Oct 13 '22 01:10

Ivan


Update your strings.xml located under res/values/

with

<string name="edit_message">Edit</string>
<string name="button_send">Send</string>
like image 20
Karthikeyan Avatar answered Oct 13 '22 01:10

Karthikeyan