Error inflating class android.support.v4.widget.drawerlayout

北城余情 提交于 2019-12-05 01:26:28

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 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.

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.

Follow steps:

1.Configure Build-Path

2.Add Android library,and android dependencies libraries

3.Order and Export all those dependencies and android library.

Go to build.gradle script and add a dependancy to support

by adding this in dependancies compile 'com.android.support:support-v4:22.1.1'

I got this error when I created a new project with the new AndroidX and copied codes from my last project which was using support Library, inside this one.

Solved it by replacing android.support.v4.widget.DrawerLayout with androidx.drawerlayout.widget.DrawerLayout

Many times there is no error but still it shows error inflating class android.support.v4.widget.drawerlayout.

I solved my problem by adding Android Support Library

Steps

Right click on Project-> Android Tools->Add Support library.

then I just cleaned the project and I worked for me...

And Obviously Check the Android Library and other Libarary...

Rodrigo Leite da Fonseca

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 this link: Thanks a lot.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!