Why won't androidx support the navigation bar?

前端 未结 3 729
长情又很酷
长情又很酷 2021-01-28 12:47

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

3条回答
  •  一向
    一向 (楼主)
    2021-01-28 13:42

    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.

提交回复
热议问题