I've done numerous searches on this topic. I have done the following:
I have used the support library for another project and it works fine but I wasn't using the drawerlayout. Below is the xml file I am calling within my activity class. This error happens when it calls setContentView(R.layout.main_sliding_layout);
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:id="@+id/frame_container"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<ListView
android:id="@+id/list_slidermenu"
android:layout_width="240dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:choiceMode="singleChoice"
android:divider="@color/list_divider"
android:dividerHeight="1dp"
android:listSelector="@drawable/list_selector"
android:background="@color/list_background"/>
</android.support.v4.widget.DrawerLayout>
In the latest releases:
If you are using androidx support library then,
Use:
androidx.drawerlayout.widget.DrawerLayout
Instead of:
android.support.v4.widget.DrawerLayout
and
Use:
com.google.android.material.navigation.NavigationView
Instead of:
android.support.design.widget.NavigationView
For other equivalent androidx classes please refer below link: https://developer.android.com/jetpack/androidx/migrate
If you just migrated to AndroidX, a same error would pop up.
Error inflating class androidx.core.widget.DrawerLayout
Just change
androidx.core.widget.DrawerLayout
to
androidx.drawerlayout.widget.DrawerLayout
in every XML.
If anyone is looking for a resolution or what happened with this, it will remain a mystery. I walked away for a couple hours to just relax and clear my head thinking I'd come back and pin point what I was over looking. I started the application and the thing just started working. I didn't make any new updates or anything. Fantastic that it is working but doesn't really help as to what was going on. Oh well, onward and upward.
Follow steps:
1.Configure Build-Path
2.Add Android library,and android dependencies libraries
3.Order and Export all those dependencies and android library.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With