The following classes cannot be created.

My homeactivity.xml says: The following classes could not be created: - android.support.design.widget.CoordinatorLayout (Open Class, Show Exception, Clear Cache) - android.support.design.widget.AppBarLayout (Open Class, Show Exception , Clear Cache) - android.support.design.widget.FloatingActionButton (Open Class, Show Exception, Clear Cache)

Here is my code

<android.support.design.widget.AppBarLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:theme="@style/AppBarOverlay"> <android.support.v7.widget.Toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" android:background="#ff4747" app:popupTheme="@style/PopupOverlay" /> <include layout="@layout/content_home" /> <android.support.design.widget.FloatingActionButton android:id="@+id/fab" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="bottom|end" android:layout_margin="@dimen/fab_margin" android:src="@android:drawable/ic_dialog_email" android:background="#001f9c" /> </android.support.design.widget.AppBarLayout> 

I do not know why this happened. Can anybody help?

+2
source share
2 answers

as you commented, you should enable dependencies for a design that is similar to this, it will be added to the dependencies block of the app build.gradle module

 compile 'com.android.support:design:23.1.1' 

it should be something like this.

enter image description here

if design dependencies not included in build.gradle and you try to use the mentioned classes in your question, you will not be able to display those classes , and the error you get in the layout will be something like this

enter image description here

0
source

I upgraded to Android Studio 2.0. This is the solution to the problem for me. Now I see the render. My only error message at this point is: "

0
source

All Articles