How to fix " Element ....is not allowed " error in layout "activity_main.xml" file

691 Views Asked by At

I have created a new android project using Android Studio 3.5.1 using the "Basic Activity" template. But could not get the Design/Text tab rather error messages "Element ...is not allowed here".

The elements are highlighted with red. I do appreciate any help.

    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <com.google.android.material.appbar.AppBarLayout
        android:layout_height="wrap_content"
        android:layout_width="match_parent"
        android:theme="@style/AppTheme.AppBarOverlay">

        <androidx.appcompat.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:background="?attr/colorPrimary"
            app:popupTheme="@style/AppTheme.PopupOverlay" />

    </com.google.android.material.appbar.AppBarLayout>

    <include layout="@layout/content_main"/>

    <com.google.android.material.floatingactionbutton.FloatingActionButton

1

There are 1 best solutions below

0
On

I have settled it by: 1- Delete "wrapper" folder under ...C:\Users[myUserAcctName].gradle 2- Reload the project and let the Gradle's sync finish (it took 34 minutes). Then went perfect. Thanks for those considering an answer.