Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error inflating class android.support.design.widget.BottomNavigationView & Error inflating class android.support.design.widget.BottomNavigationView

Caused by: android.view.InflateException: Binary XML file line #19: Binary XML file line #19: Error inflating class android.support.design.widget.BottomNavigationView
Caused by: android.view.InflateException: Binary XML file line #19: Error inflating class android.support.design.widget.BottomNavigationView

gradle source

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.0.2'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'com.google.android.material:material:1.1.0-alpha01'
    implementation 'androidx.cardview:cardview:1.0.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test.ext:junit:1.1.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
}

layout xml source

 <android.support.design.widget.BottomNavigationView
        android:id="@+id/navigationView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="?android:attr/windowBackground"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toLeftOf="parent"
        app:menu="@menu/menu_bottomnavigationview">  
 </android.support.design.widget.BottomNavigationView>

what am I missing? does androidstuido still support android.support.design.widget.BottomNavigationView"?

like image 392
thrillingchase Avatar asked Jul 01 '26 05:07

thrillingchase


1 Answers

The class android.support.design.widget.BottomNavigationView is provided by the design support library.
It requires the com.android.support:design:28.0.0 dependency.

You are using androidx libraries.
In this case you have to use the Material Components Library.

It requires the dependency:

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

and the component is com.google.android.material.bottomnavigation.BottomNavigationView

like image 107
Gabriele Mariotti Avatar answered Jul 05 '26 17:07

Gabriele Mariotti