element LinearLayout must be declared

android-linearlayout, android-studio

Solution

Make sure you have `action_settings` defined inside menu's xml file

res/menu/yourmenufile.xml

like this :

<menu xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    tools:context="com.example.app" >

    <item android:id="@+id/action_settings"
        android:title="@string/action_settings"
        android:orderInCategory="100"
        app:showAsAction="never" />
</menu>

Problem

I have updated my android studio and now I have a problem in my main.xml, it displays the following error: `element LinearLayout must be declared` this is my code: ``` <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_height="fill_parent" android:layout_width="fill_parent" android:gravity="center_vertical|center_horizontal" > <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/monBouton" android:text="Cliquez ici !" > </Button> </LinearLayout> ``` this is the error message: error : Execution failed for task ':app:compileDebugJava'. Compilation failed; see the compiler error output for details. error : cannot find symbol variable action_settings How can I solve it?

Original source