Error inflating class com.google.android.material.bottomnavigation.BottomNavigationView

Instead of

app:itemBackground="?colorPrimary"

set

app:itemBackground="@color/colorPrimary"

Edit: also check that the drawables are in res/drawable folder and not in a folder like res/drawable-v21


Make sure that you put drawables in res/drawable folder and not in res/drawable-v24. I had a similar problem and by moving files to the res/drawable folder the error has gone.


Your problem is related with the resources you are using on your BottomNavigationView widget.

One of these is the issue:

app:itemBackground="?colorPrimary"
app:itemIconTint="@drawable/bottom_navigation_selector"
app:itemTextColor="@drawable/bottom_navigation_selector"

Check if your drawables exits in both res/drawable and any res/drawable-vXX you might have.