Don’t know if this relates to your problem. I changed tags of TabLayout and ViewPager to ones that correspond to ones on this page: https://material.io/develop/android/components/tab-layout/
Here is my code from my app, which made errors go away:
<com.google.android.material.tabs.TabLayout
android:id="@+id/sliding_tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:tabMode="fixed"/>
<androidx.viewpager.widget.ViewPager
android:id="@+id/viewpager"
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_weight="1"
android:background="@android:color/white" />