Error Inflating Class Android.Support.Design.Widget.Coordinatorlayout and Classnotfoundexception: Android.Support.Design.R$Styleable

Error inflating class android.support.design.widget.CoordinatorLayoute

Replace

    <?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/Theme.AppCompat.Light.DarkActionBar">

<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/ThemeOverlay.AppCompat.Dark" />

</android.support.design.widget.AppBarLayout>

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

With

<android.support.design.widget.CoordinatorLayout 
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent">

<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/Theme.AppCompat.Light.DarkActionBar">

<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/ThemeOverlay.AppCompat.Dark" />

</android.support.design.widget.AppBarLayout>

<include layout="@layout/content_game" />
</android.support.design.widget.CoordinatorLayout>

Also add compile 'com.android.support:design:22.2.1' in build.gradle

Error inflating class android.support.design.widget.CoordinatorLayout

Please change it into AppCompatActivity if you use Activity. Probably it becomes the error when it is Activity.

ANDROID: Error inflating class android.support.design.widget.AppBarLayout

You need to use

<com.google.android.material.appbar.AppBarLayout
<androidx.appcompat.widget.Toolbar

Instead of

<android.support.design.widget.AppBarLayout
<android.support.v7.widget.Toolbar

SAMPLE CODE

<com.google.android.material.appbar.AppBarLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/app_bar"
android:theme="@style/Theme.AppCompat.Light.DarkActionBar"
android:layout_width="match_parent"
android:layout_height="wrap_content">

<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:elevation="4dp"
android:theme="@style/ThemeOverlay.AppCompat.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" >

</androidx.appcompat.widget.Toolbar>

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

Make sure u have added below dependencies

implementation 'com.google.android.material:material:1.0.0'

UPDATE

if you have used Toolbar and AppBarLayout inside your activity then make sure you have correct imports inside your activity code

import androidx.appcompat.widget.Toolbar
import com.google.android.material.appbar.AppBarLayout

Didn't find class android.support.design.widget.CoordinatorLayout using Buck

Make sure the versions you've mentioned in your BUCK config are correct.

In the code you've shared in your question i see v23.0.1 for support and design libraries. In your github repository I see v23.4.0.

Sample Image

I'm suspecting this is the reason. Change to the correct version you've included in your libs folder and see if it works.

Update in response to edit 5 in your question:

The following two dependencies will help resolve the VectorDrawableCompat ClassNotFoundException. Include them in a suitable way for BUCK.

compile 'com.android.support:support-vector-drawable:23.4.0'
compile 'com.android.support:animated-vector-drawable:23.4.0'

Error inflating class android.support.design.widget.Coordinator in Xamarin

try to change like this:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.Toolbar
android:minWidth="25dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?attr/actionBarSize"
android:id="@+id/mainToolbar" />
<android.support.v4.widget.DrawerLayout
android:id="@+id/drawerLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<include
layout="@layout/include_main"
android:layout_width="match_parent"
android:layout_height="match_parent" />

<android.support.design.widget.NavigationView
android:id="@+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
app:headerLayout="@layout/headerlayout"
app:menu="@menu/navmenu"
/>

</android.support.v4.widget.DrawerLayout>
</LinearLayout>

include_main :

<?xml version="1.0" encoding="utf-8"?>
<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="vertical">

<FrameLayout
android:id="@+id/fragmentContainer"
android:layout_width="match_parent"
android:layout_height="match_parent" />

</LinearLayout>


Related Topics



Leave a reply



Submit