Android Studio: My activitymain.xml does not recognize string.xml variables

0

I have a very basic application in android studio, which accesses the accelerometer and the gyroscope, and their respective values are shown in the application.

Everything was fine until "suddenly", the texts of the main activity are not recognized, whose contents are defined in the file string.xml. For example:

I have my activity_main.xml file with things like this:

   <TableLayout 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="vertical"
tools:context=".MainActivity">

<TableRow>
    <TextView
        android:textAlignment="center"
        android:text="@string/sens_accelerometer"
        android:background="#e9ff7a81"/>
</TableRow>

             

    <TextView
        android:id="@+id/axisX_text"
        android:layout_column="1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="left"/>
</TableRow>....</TableLayout>

On the other hand, the string.xml file is of the style:

  <resources>
    <string name="app_name"> Sensors </string>
    .....
    <string name="sens_accelerometer">Accelerometer </string>
    ....
</resources>

Everything was fine until today, the error that appears to me is the one that I attach to the image.

And the error is given in the file activity_main.xml, every time I want to access a string of string.xml, that is, in lines similar to:

 android:text="@string/sens_accelerometer"

Could someone advise me on what could be the cause? I was not able to solve it.

Thanks in advance.

    
asked by Laura 10.07.2018 в 21:58
source

1 answer

1

Try to do this from Android Studio, there seems to be nothing wrong with your string

Build - Clean project - Rebuild Project
    
answered by 10.07.2018 в 22:49