So I\'m trying to get a navigation drawer done using this tutorial (https://www.youtube.com/watch?v=fGcMLu1GJEc&t=16s) however, I undersetand that something has changed in A
The error says you are using the drawer layout from support compat you have to use the material drawer layout
Here is how to add the library
https://material.io/develop/android/docs/getting-started/
Here is how to add the drawer
https://material.io/develop/android/components/navigation-view/
AndroidX replaces the original support library APIs with packages in the androidx namespace.
Looks like you are using some of the support library classes in your xmls as you can see in the logs:
Didn't find class "android.support.v4.widget.DrawerLayout" on path: DexPathList
android.support.v4.widget.DrawerLayout
In your xml that is being inflated in the MainActivity, replace this:
android.support.v4.widget.DrawerLayout
with this:
androidx.drawerlayout.widget.DrawerLayout
This should solve this error for you.
However, I am positive there will be more xmls with older support library classes. Refer here and search for the class causing the error as above and replace it with the corresponding androidx class.
remove androidx.appcompat.widget.Toolbar from parent view and use below xml
<androidx.drawerlayout.widget.DrawerLayout
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"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context=".MainActivity"
tools:openDrawer="start">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="vertical">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@color/colorPrimary"
android:elevation="4dp"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
<FrameLayout
android:id="@+id/fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
</androidx.drawerlayout.widget.DrawerLayout>