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

Solution 1:

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

Solution 2:

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.