ClassNotFoundException re android.support.v4.view.ViewPager when inflating

For androidX support library for viewpager has been replaced with

androidx.viewpager:viewpager:1.0.0

Replace your dependency with this in your gradle.

You are mixing libraries for androidX and support library, Use either one of them. Update non-androidX dependency with androidX one or replace androidX with support libraries.


If you are using implementation "androidx.viewpager:viewpager:1.0.0"

Also, change in XML file too

<androidx.viewpager.widget.ViewPager
    android:id="@+id/pager"
    android:layout_width="match_parent"
    android:layout_height="fill_parent"/>